home *** CD-ROM | disk | FTP | other *** search
/ The World's Largest Collection of Windows Software / The World's Largest Collection of Windows Software - Disc 1.iso / connect / _j2 / wvnsc926 / rcs / wvart.c < prev    next >
C/C++ Source or Header  |  1994-09-21  |  77KB  |  2,975 lines

  1. head    1.33;
  2. access;
  3. symbols
  4.     V80:1.8
  5.     V76d:1.1;
  6. locks; strict;
  7. comment    @ * @;
  8.  
  9.  
  10. 1.33
  11. date    94.09.22.00.09.56;    author jcooper;    state Exp;
  12. branches;
  13. next    1.32;
  14.  
  15. 1.32
  16. date    94.09.18.22.48.51;    author jcooper;    state Exp;
  17. branches;
  18. next    1.31;
  19.  
  20. 1.31
  21. date    94.09.16.00.53.16;    author jcooper;    state Exp;
  22. branches;
  23. next    1.30;
  24.  
  25. 1.30
  26. date    94.08.24.17.59.26;    author jcooper;    state Exp;
  27. branches;
  28. next    1.29;
  29.  
  30. 1.29
  31. date    94.08.11.00.18.04;    author jcooper;    state Exp;
  32. branches;
  33. next    1.28;
  34.  
  35. 1.28
  36. date    94.08.03.00.54.10;    author gardnerd;    state Exp;
  37. branches;
  38. next    1.27;
  39.  
  40. 1.27
  41. date    94.07.27.21.14.38;    author gardnerd;    state Exp;
  42. branches;
  43. next    1.26;
  44.  
  45. 1.26
  46. date    94.07.12.19.16.13;    author rushing;    state Exp;
  47. branches;
  48. next    1.25;
  49.  
  50. 1.25
  51. date    94.07.01.03.45.53;    author dumoulin;    state Exp;
  52. branches;
  53. next    1.24;
  54.  
  55. 1.24
  56. date    94.06.30.21.30.22;    author gardnerd;    state Exp;
  57. branches;
  58. next    1.23;
  59.  
  60. 1.23
  61. date    94.06.23.23.07.13;    author dumoulin;    state Exp;
  62. branches;
  63. next    1.22;
  64.  
  65. 1.22
  66. date    94.06.01.19.01.51;    author gardnerd;    state Exp;
  67. branches;
  68. next    1.21;
  69.  
  70. 1.21
  71. date    94.06.01.18.50.49;    author rushing;    state Exp;
  72. branches;
  73. next    1.20;
  74.  
  75. 1.20
  76. date    94.05.27.01.29.29;    author rushing;    state Exp;
  77. branches;
  78. next    1.19;
  79.  
  80. 1.19
  81. date    94.05.23.18.36.00;    author jcooper;    state Exp;
  82. branches;
  83. next    1.18;
  84.  
  85. 1.18
  86. date    94.02.24.21.26.54;    author jcoop;    state Exp;
  87. branches;
  88. next    1.17;
  89.  
  90. 1.17
  91. date    94.01.24.17.41.01;    author jcoop;    state Exp;
  92. branches;
  93. next    1.16;
  94.  
  95. 1.16
  96. date    94.01.16.12.23.43;    author jcoop;    state Exp;
  97. branches;
  98. next    1.15;
  99.  
  100. 1.15
  101. date    93.12.08.01.28.38;    author rushing;    state Exp;
  102. branches;
  103. next    1.14;
  104.  
  105. 1.14
  106. date    93.08.25.18.54.36;    author mbretherton;    state Exp;
  107. branches;
  108. next    1.13;
  109.  
  110. 1.13
  111. date    93.08.05.20.06.07;    author jcoop;    state Exp;
  112. branches;
  113. next    1.12;
  114.  
  115. 1.12
  116. date    93.07.06.21.09.50;    author cnolan;    state Exp;
  117. branches;
  118. next    1.11;
  119.  
  120. 1.11
  121. date    93.06.26.00.53.33;    author rushing;    state Exp;
  122. branches;
  123. next    1.10;
  124.  
  125. 1.10
  126. date    93.06.26.00.18.46;    author rushing;    state Exp;
  127. branches;
  128. next    1.9;
  129.  
  130. 1.9
  131. date    93.06.22.16.45.00;    author bretherton;    state Exp;
  132. branches;
  133. next    1.8;
  134.  
  135. 1.8
  136. date    93.06.11.00.11.26;    author rushing;    state Exp;
  137. branches;
  138. next    1.7;
  139.  
  140. 1.7
  141. date    93.05.29.03.32.30;    author rushing;    state Exp;
  142. branches;
  143. next    1.6;
  144.  
  145. 1.6
  146. date    93.05.28.18.23.40;    author rushing;    state Exp;
  147. branches;
  148. next    1.5;
  149.  
  150. 1.5
  151. date    93.05.24.23.28.24;    author rushing;    state Exp;
  152. branches;
  153. next    1.4;
  154.  
  155. 1.4
  156. date    93.05.18.22.11.40;    author rushing;    state Exp;
  157. branches;
  158. next    1.3;
  159.  
  160. 1.3
  161. date    93.05.06.19.43.41;    author rushing;    state Exp;
  162. branches;
  163. next    1.2;
  164.  
  165. 1.2
  166. date    93.03.30.20.08.25;    author rushing;    state Exp;
  167. branches;
  168. next    1.1;
  169.  
  170. 1.1
  171. date    93.02.16.20.53.50;    author rushing;    state Exp;
  172. branches;
  173. next    ;
  174.  
  175.  
  176. desc
  177. @winvn version 0.76 placed into RCS
  178. @
  179.  
  180.  
  181. 1.33
  182. log
  183. @Check if text is selected before allowing RMB click to copy
  184. @
  185. text
  186. @/*
  187.  *
  188.  * $Id: wvart.c 1.33 1994/09/19 16:06:27 jcooper Exp $
  189.  * $Log: wvart.c $
  190.  * Revision 1.33  1994/09/19  16:06:27  jcooper
  191.  * Check if text is selected before allowing RMB click to copy
  192.  * 
  193.  * Revision 1.32  1994/09/18  22:48:51  jcooper
  194.  * support for cascading windows
  195.  * 
  196.  * Revision 1.31  1994/09/16  00:53:16  jcooper
  197.  * massive cleanup for 92.6
  198.  * 
  199.  * Revision 1.30  1994/08/24  17:59:26  jcooper
  200.  * misc encoding/decoding changes
  201.  *
  202.  * Revision 1.29  1994/08/11  00:18:04  jcooper
  203.  * added support for article retreive complete message
  204.  *
  205.  * Revision 1.28  1994/08/03  00:54:10  gardnerd
  206.  * Fixed bug with cut to clipboard at 1st and last line of text
  207.  *
  208.  * Revision 1.27  1994/07/27  21:14:38  gardnerd
  209.  * copy to clipboard
  210.  *
  211.  * Revision 1.26  1994/07/12  19:16:13  rushing
  212.  * missing curlies in CloseArtWnd()
  213.  *
  214.  * Revision 1.25  1994/07/01  03:45:53  dumoulin
  215.  * Added the Find Next Unseen and concept of SPACE as a "power key"
  216.  *
  217.  * Revision 1.24  1994/06/30  21:30:22  gardnerd
  218.  * Allow scrolling by pixels instead of characters
  219.  *
  220.  * Revision 1.23  1994/06/23  23:07:13  dumoulin
  221.  * added menu item for Printer Setup
  222.  *
  223.  * Revision 1.22  1994/06/01  19:01:51  gardnerd
  224.  * horizontal scrolling support
  225.  *
  226.  * Revision 1.21  1994/06/01  18:50:49  rushing
  227.  * more f3 bugs
  228.  *
  229.  * Revision 1.20  1994/05/27  01:29:29  rushing
  230.  * unnecessary winundoc.h
  231.  *
  232.  * Revision 1.19  1994/05/23  18:36:00  jcooper
  233.  * new attach code, session [dis]connect
  234.  *
  235.  * Revision 1.18  1994/02/24  21:26:54  jcoop
  236.  * jcoop changes
  237.  *
  238.  * Revision 1.17  1994/01/24  17:41:01  jcoop
  239.  * 90.2 changes
  240.  *
  241.  * Revision 1.16  1994/01/16  12:23:43  jcoop
  242.  * New font/color painting.  no longer use view_art_by_id
  243.  *
  244.  * Revision 1.15  1993/12/08  01:28:38  rushing
  245.  * new version box and cr lf consistency
  246.  * 
  247.  * Revision 1.14  1993/08/25  18:54:36  mbretherton
  248.  * MRB merge, mail & post logging
  249.  *
  250.  *
  251.  * Revision 1.1x  1993/07/21 MBretherton
  252.  *                remove vRef from MRROpenFile (Mac Stuff)
  253.  *
  254.  * Revision 1.13  1993/08/05  20:06:07  jcoop
  255.  * save multiple articles changes by jcoop@@oakb2s01.apl.com (John S Cooper)
  256.  *
  257.  * Revision 1.12  1993/07/06  21:09:50  cnolan
  258.  * win32 support
  259.  *
  260.  * Revision 1.11  1993/06/26  00:53:33  rushing
  261.  * warnings
  262.  *
  263.  * Revision 1.10  1993/06/26  00:18:46  rushing
  264.  * warnings
  265.  *
  266.  * Revision 1.9  1993/06/22  16:45:00  bretherton
  267.  * *** empty log message ***
  268.  *
  269.  * Revision 1.xx M Bretherton  Fix
  270.  *               Mail != Forward in terms of underlying mail support  
  271.  * Revision 1.8  1993/06/11  00:11:26  rushing
  272.  * second merge from Matt Bretherton sources
  273.  *
  274.  * Revision 1.7  1993/05/29  03:32:30  rushing
  275.  * threading support
  276.  *
  277.  * Revision 1.6  1993/05/28  18:23:40  rushing
  278.  * fixed far/huge problem in find_art_by_subject
  279.  *
  280.  * Revision 1.5  1993/05/24  23:28:24  rushing
  281.  * header formatting (MRB)
  282.  *
  283.  *
  284.  * Revision 1.4  1993/05/18  22:11:40  rushing
  285.  * smtp support
  286.  *
  287.  * Revision 1.3  1993/05/06  19:43:41  rushing
  288.  * added Re: fix from MB
  289.  *
  290.  * Revision 1.2  1993/03/30  20:08:25  rushing
  291.  * MAPI
  292.  *
  293.  * Revision 1.1  1993/02/16  20:53:50  rushing
  294.  * Initial revision
  295.  *
  296.  *
  297.  */
  298.  
  299. /*---  wvart.c ------------------------------------------- */
  300. /*  This file contains the window procedure for the Article Viewing window
  301.  *  for WinVn.
  302.  */
  303.  
  304. #include <windows.h>
  305. #include <windowsx.h>
  306. #include "wvglob.h"
  307. #include "winvn.h"
  308. #pragma hdrstop
  309. #include <ctype.h>
  310.  
  311. int cursor_to_char_number (int X, int Y,TypDoc *DocPtr,TypBlock far **BlockPtr,TypLine far **LinePtr);
  312. void CloseArtWnd(HWND hWnd, TypDoc *ThisDoc);
  313. void UpdateHighlightedText(TypDoc far *DocPtr, TextSelect far *PreviousPos);
  314. void HighlightText(TypDoc far *DocPtrs);
  315. void CopyTextToClipBoard(TypDoc FAR *DocPtr);
  316. void SetArticleMenus (HWND hWnd, int enable);
  317.   
  318. /************** find_article_geader_subject *************
  319.  *
  320.  *   Amended to ignore Re: in either heading line as part of match
  321.  *   criteria
  322.  *
  323.  *  Note the duplication of Knowledge of the rules of subject header
  324.  *  format with wvheader : GetArticleSubject
  325.  *
  326.  *  Ideally some object containing all knowledge of rules of format
  327.  *  would be a more elegant implementation
  328.  *  Also note heading changes with each find next of same heading
  329.  *  request. Ideally want to maintain first heading in series
  330.  *  allowing a more liberal interpreation of 'same' in same heading
  331.  *
  332.  *                       Matthew Bretherton 2nd March 1993
  333.  *
  334.  ********************************************************/
  335.  
  336. long find_article_by_subject (header_p headers,
  337.                   long artindex,
  338.                   long num_headers)
  339. {
  340.   char far *nextsub ;
  341.   char far *thissub;
  342.  
  343.   thissub = (header_elt(headers,artindex++))->subject;
  344.   if (CompareStringNoCase (thissub, "Re:", 3) == 0) thissub=thissub + 4;
  345.  
  346.   if (artindex >= num_headers) return (-1);
  347.  
  348.   do {
  349.     nextsub = (header_elt(headers,artindex))->subject ;
  350.     if (CompareStringNoCase (nextsub, "Re:", 3) == 0) nextsub=nextsub + 4;
  351.     if (lstrcmpi (nextsub, thissub) == 0)
  352.       return (artindex);        /* return the index */
  353.   } while (artindex++ < num_headers);
  354.  
  355.   return (-1);                  /* not found */
  356. }
  357.  
  358.  
  359. /****************************************************************************
  360.  
  361.     FUNCTION: WinVnArtWndProc(HWND, unsigned, WORD, LONG)
  362.  
  363.     PURPOSE:  Processes messages
  364.  
  365. ****************************************************************************/
  366.  
  367. long WINAPI WinVnArtWndProc (hWnd, message, wParam, lParam)
  368.      HWND hWnd;
  369.      unsigned message;
  370.      WPARAM wParam;
  371.      LPARAM lParam;
  372. {
  373.   PAINTSTRUCT ps;               /* paint structure          */
  374.  
  375.   HDC hDC;                      /* handle to display context */
  376.   RECT myRect;                  /* selection rectangle      */
  377.   TypDoc *ThisDoc;
  378.   TypGroup far *GroupDoc;
  379.   int ih, j;
  380.   int found, X, Y, charnum;
  381.   int CtrlState;
  382.   TypLine far *LinePtr;
  383.   TypBlock far *BlockPtr;
  384.   HANDLE hBlock;
  385.   char mybuf[MAXINTERNALLINE];
  386.   unsigned int Offset;
  387.   char far *textptr;
  388.   int textlen;
  389.   BOOL continueFind;
  390.   TypLineID MyLineID,artindex;
  391.   HANDLE header_handle;
  392.   HANDLE thread_handle;
  393.   header_p headers;
  394.   header_p header;
  395.   long header_num;
  396.      
  397.   for (ih = 0, found = FALSE; !found && ih < MAXARTICLEWNDS; ih++)
  398.     {
  399.       if (ArticleDocs[ih].hDocWnd == hWnd)
  400.     {
  401.       found = TRUE;
  402.       ThisDoc = &(ArticleDocs[ih]);
  403.     }
  404.     }
  405.  
  406.   if (!found)
  407.     {
  408.       ThisDoc = CommDoc;
  409.     }
  410.  
  411.  
  412.   switch (message)
  413.     {
  414.  
  415.     case WM_CREATE:
  416.       NumArticleWnds++;
  417.       SetArticleMenus(hWnd, DISABLE);
  418.       break;
  419.       
  420.     case WM_ACTIVATE:
  421.     case WM_SETFOCUS:
  422.       if (wParam)
  423.     {
  424.       ActiveArticleDoc = ThisDoc;
  425.     }
  426.       /* fall through */
  427.     case WM_SYSCOMMAND:
  428.       return (DefWindowProc (hWnd, message, wParam, lParam));
  429.  
  430.     case WM_SIZE:
  431.       GetClientRect (hWnd, &myRect);
  432.       ThisDoc->ScXWidth = myRect.right;
  433.       ThisDoc->ScYHeight = myRect.bottom;
  434.       ThisDoc->ScYLines = (myRect.bottom - myRect.top - ArtTopSpace) / ArtLineHeight;
  435.       ThisDoc->ScXChars = (myRect.right - myRect.left - ArtSideSpace) / ArtCharWidth;
  436.       break;
  437.  
  438.     case WM_CLOSE:
  439.       ThisDoc->TextSelected = FALSE;
  440.       CloseArtWnd(hWnd, ThisDoc);
  441.       break;
  442.       
  443.     case WM_DESTROY:
  444.       NumArticleWnds--;
  445.       ThisDoc->TextSelected = FALSE;
  446.       ThisDoc->InUse = FALSE;
  447.       ThisDoc->LongestLine = 0;
  448.       ThisDoc->ScXOffset = 0;
  449.       if (ThisDoc == CommDoc)
  450.     {
  451.       CommBusy = FALSE;
  452.       CommDoc = (TypDoc *) NULL;
  453.     }
  454.       /* Clear the pointer in the line for this article in the   */
  455.       /* group  document.  This pointer currently points       */
  456.       /* to the current document, which we are wiping out      */
  457.       /* with the destruction of this window.                  */
  458.  
  459.       if (ThisDoc->ParentDoc)
  460.     {
  461.     LockLine (ThisDoc->ParentDoc->hParentBlock,
  462.           ThisDoc->ParentDoc->ParentOffset,
  463.           ThisDoc->ParentDoc->ParentLineID,
  464.           &BlockPtr, &LinePtr);
  465.  
  466.     GroupDoc = (TypGroup far *) ((char far *) LinePtr + sizeof (TypLine));
  467.  
  468.     header_handle = GroupDoc->header_handle;
  469.     thread_handle = GroupDoc->thread_handle;        
  470.     headers = lock_headers (header_handle,thread_handle);
  471.  
  472.     (header_elt(headers,ThisDoc->LastSeenLineID))->ArtDoc = (TypDoc *) NULL;
  473.     UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  474.     unlock_headers (header_handle, thread_handle);
  475.     }
  476.       /* Clear document                                        */
  477.       FreeDoc (ThisDoc);
  478.  
  479.       /* If there's another article window, make it the active   */
  480.       /* artcile window so we don't create a new one if the      */
  481.       /* New Article flag is FALSE.                              */
  482.  
  483.       for (j = MAXARTICLEWNDS - 1; j >= 0; j--)
  484.     {
  485.       if (ArticleDocs[j].InUse)
  486.         {
  487.           ActiveArticleDoc = &(ArticleDocs[j]);
  488.           break;
  489.         }
  490.     }
  491.       break;
  492.  
  493.     case WM_KEYDOWN:
  494.       /* See if this key should be mapped to a scrolling event
  495.        * for which we have programmed the mouse.  If so,
  496.        * construct the appropriate mouse call and call the mouse code.
  497.        */
  498.  
  499.       if (wParam == VK_F6)
  500.     {
  501.       NextWindow (ThisDoc);
  502.     }
  503.       else 
  504.         if (wParam == VK_SPACE)
  505.          {   
  506.            if (ThisDoc->ActiveLines > (ThisDoc->ScYLines + ThisDoc->TopLineOrd))
  507.             {
  508.              SendMessage (hWnd,(UINT) WM_KEYDOWN, (WPARAM) VK_NEXT, (LPARAM) 0L);
  509.              break; 
  510.             }
  511.            else 
  512.              { 
  513.               if (!(CommBusy && ThisDoc == CommDoc))
  514.                 SendMessage (hWnd,(UINT) WM_COMMAND, (WPARAM) IDM_FIND_NEXT_UNSEEN, (LPARAM) 0L); 
  515.               break;
  516.               }
  517.          }
  518.       else
  519.     {
  520.       CtrlState = GetKeyState (VK_CONTROL) < 0;
  521.       for (j = 0; j < NUMKEYS; j++)
  522.         {
  523.           if (wParam == key2scroll[j].wVirtKey &&
  524.           CtrlState == key2scroll[j].CtlState)
  525.         {
  526.           SendMessage (hWnd, key2scroll[j].iMessage,
  527.                    key2scroll[j].wRequest, 0L);
  528.           break;
  529.         }
  530.         }
  531.     }
  532.  
  533.       break;    
  534.       
  535.      case WM_RBUTTONDOWN:
  536.        if (ThisDoc->TextSelected) {
  537.           CopyTextToClipBoard(ThisDoc);
  538.           SendMessage (hWnd, (UINT) WM_COMMAND, (WPARAM) IDM_DESELECT_ALL, (LPARAM) 0L);  //Un-mark selection
  539.        }
  540.        break;
  541.  
  542.  
  543.     case WM_LBUTTONDOWN: 
  544.     {
  545.       int TempX, TempY;
  546.                  
  547.       if (CommBusy && CommDoc == ThisDoc)
  548.       {
  549.         MessageBox (hWnd, "Please wait until article retrieval is complete before selecting text.", "Please Wait", MB_OK);
  550.       }
  551.       else    
  552.       {
  553.         DragMouseAction = DRAG_SELECT; 
  554.         ThisDoc->TextSelected = FALSE; 
  555.         EnableMenuItem(GetMenu(hWnd),IDM_COPY,MF_GRAYED) ;
  556.         EnableMenuItem(GetMenu(hWnd),IDM_DESELECT_ALL,MF_GRAYED) ;
  557.         X = LOWORD (lParam);
  558.         Y = HIWORD (lParam);
  559.   
  560.         if (X < ArtSideSpace)
  561.         {
  562.           TempX = ArtSideSpace;
  563.         }
  564.         else
  565.         {
  566.           TempX = min(X, (int)ThisDoc->ScXWidth);
  567.         }
  568.   
  569.         if (Y < ArtTopSpace)
  570.         {
  571.           TempY = ArtTopSpace;
  572.         }
  573.         else
  574.         { 
  575.           TempY = min(Y, (int)(ArtTopSpace + (ThisDoc->ScYLines-1) * ArtLineHeight));
  576.           if(TempY > (int)(ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * ArtLineHeight))
  577.           {
  578.             TempY = (int)ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * (int)ArtLineHeight;
  579.           }  
  580.         }
  581.   
  582.         ThisDoc->BeginSelect.LineNum = (TempY - ArtTopSpace) / ArtLineHeight + ThisDoc->TopLineOrd;
  583.         ThisDoc->BeginSelect.CharNum = cursor_to_char_number (TempX,TempY,ThisDoc,&BlockPtr,&LinePtr);
  584.         ThisDoc->EndSelect.LineNum = -1; 
  585.         SetRect(&myRect, 0, 0, ThisDoc->ScXWidth, ThisDoc->ScYHeight);   
  586.         InvalidateRect(ThisDoc->hDocWnd, &myRect, FALSE);
  587.         SetCursor(LoadCursor(NULL, IDC_IBEAM));
  588.         SetCapture(hWnd);
  589.       }
  590.     }    
  591.     break;  
  592.               
  593.     case WM_MOUSEMOVE:
  594.     {
  595.       int X, Y, TempX, TempY;
  596.       TextSelect Previous;
  597.       int ScMin, ScMax;
  598.       POINT CursorLocation;
  599.       MSG Message;
  600.       BOOL ScrollText = FALSE;
  601.       void CheckForUpdate();      
  602.                  
  603.       if(DragMouseAction == DRAG_SELECT)
  604.       {  
  605.         ThisDoc->TextSelected = TRUE;
  606.         EnableMenuItem(GetMenu(hWnd),IDM_COPY,MF_ENABLED) ;
  607.         EnableMenuItem(GetMenu(hWnd),IDM_DESELECT_ALL,MF_ENABLED) ;
  608.         X = LOWORD (lParam);
  609.         Y = HIWORD (lParam);
  610.         
  611.         // Check to see if text selection needs to scroll left.
  612.         if((X < 0) && (ThisDoc->ScXOffset > 0))
  613.         { 
  614.           ScrollText = TRUE;
  615.  
  616.           do // keep scrolling until the mouse moves.
  617.           { 
  618.             TempX = ArtSideSpace;
  619.             if (Y < ArtTopSpace)
  620.             {
  621.               TempY = ArtTopSpace;
  622.             }
  623.             else
  624.             {
  625.               TempY = min(Y, (int)(ArtTopSpace + (ThisDoc->ScYLines-1) * ArtLineHeight));
  626.               if(TempY > (int)(ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * ArtLineHeight))
  627.               {
  628.                 TempY = (int)ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * (int)ArtLineHeight;
  629.               }  
  630.             }
  631.             
  632.             Previous.LineNum = ThisDoc->EndSelect.LineNum;
  633.             Previous.CharNum = ThisDoc->EndSelect.CharNum;
  634.             SendMessage(ThisDoc->hDocWnd, WM_HSCROLL, SB_LINEUP, 0);
  635.             ThisDoc->EndSelect.LineNum = (TempY - (int)ArtTopSpace) / (int)ArtLineHeight + ThisDoc->TopLineOrd; 
  636.             ThisDoc->EndSelect.CharNum = cursor_to_char_number (TempX,TempY,ThisDoc,&BlockPtr,&LinePtr);
  637.             UpdateHighlightedText(ThisDoc, &Previous);                       
  638.             SendMessage(ThisDoc->hDocWnd, WM_PAINT, 0, 0);
  639.             if(PeekMessage(&Message, ThisDoc->hDocWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_NOREMOVE))
  640.               break;
  641.             GetCursorPos(&CursorLocation);
  642.             ScreenToClient(ThisDoc->hDocWnd, &CursorLocation);
  643.           }
  644.           while((X == CursorLocation.x) && (Y == CursorLocation.y) &&
  645.                 (ThisDoc->ScXOffset > 0));
  646.         }
  647.         
  648.         GetScrollRange(ThisDoc->hDocWnd, SB_HORZ, &ScMin, &ScMax);
  649.         // Check to see if text selection needs to scroll right.
  650.         if((X > (int)ThisDoc->ScXWidth) && ((int)ThisDoc->ScXOffset < ScMax))
  651.         { 
  652.           ScrollText = TRUE;
  653.             
  654.           do // keep scrolling until the mouse moves.
  655.           { 
  656.             TempX = ThisDoc->ScXWidth;
  657.             if (Y < ArtTopSpace)
  658.             {
  659.               TempY = ArtTopSpace;
  660.             }
  661.             else
  662.             {
  663.               TempY = min(Y, (int)(ArtTopSpace + (ThisDoc->ScYLines-1) * ArtLineHeight));
  664.               if(TempY > (int)(ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * ArtLineHeight))
  665.               {
  666.                 TempY = (int)ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * (int)ArtLineHeight;
  667.               }  
  668.             }
  669.  
  670.             Previous.LineNum = ThisDoc->EndSelect.LineNum;
  671.             Previous.CharNum = ThisDoc->EndSelect.CharNum;
  672.             SendMessage(ThisDoc->hDocWnd, WM_HSCROLL, SB_LINEDOWN, 0);
  673.             ThisDoc->EndSelect.LineNum = (TempY - (int)ArtTopSpace) / (int)ArtLineHeight + ThisDoc->TopLineOrd; 
  674.             ThisDoc->EndSelect.CharNum = cursor_to_char_number (TempX,TempY,ThisDoc,&BlockPtr,&LinePtr);
  675.                                     
  676.             UpdateHighlightedText(ThisDoc, &Previous); 
  677.             SendMessage(ThisDoc->hDocWnd, WM_PAINT, 0, 0);
  678.             if(PeekMessage(&Message, ThisDoc->hDocWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_NOREMOVE))
  679.               break;
  680.             GetCursorPos(&CursorLocation);
  681.             ScreenToClient(ThisDoc->hDocWnd, &CursorLocation);
  682.             }
  683.             while((X == CursorLocation.x) && (Y == CursorLocation.y)
  684.                && ((int)ThisDoc->ScXOffset < ScMax));
  685.         }     
  686.  
  687.         // Check to see if text selection needs to scroll up.
  688.         if((Y < 0) && (ThisDoc->TopLineOrd > 0))
  689.         { 
  690.           ScrollText = TRUE;
  691.           
  692.           do // keep scrolling until the mouse moves.
  693.           { 
  694.             TempY = ArtTopSpace;
  695.             if (X < ArtSideSpace)
  696.             {
  697.               TempX = ArtSideSpace;
  698.             }
  699.             else
  700.             {
  701.               TempX = min(X, (int)ThisDoc->ScXWidth);
  702.             }
  703.                           
  704.             Previous.LineNum = ThisDoc->EndSelect.LineNum;
  705.             Previous.CharNum = ThisDoc->EndSelect.CharNum;
  706.             SendMessage(ThisDoc->hDocWnd, WM_VSCROLL, SB_LINEUP, 0);
  707.             ThisDoc->EndSelect.LineNum = (TempY - (int)ArtTopSpace) / (int)ArtLineHeight + ThisDoc->TopLineOrd; 
  708.             ThisDoc->EndSelect.CharNum = cursor_to_char_number (TempX,TempY,ThisDoc,&BlockPtr,&LinePtr);
  709.             UpdateHighlightedText(ThisDoc, &Previous);
  710.             SendMessage(ThisDoc->hDocWnd, WM_PAINT, 0, 0);
  711.             if(PeekMessage(&Message, ThisDoc->hDocWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_NOREMOVE))
  712.               break;
  713.             GetCursorPos(&CursorLocation);
  714.             ScreenToClient(ThisDoc->hDocWnd, &CursorLocation); 
  715.           }
  716.           while((X == CursorLocation.x) && (Y == CursorLocation.y)
  717.              && (ThisDoc->TopLineOrd > 0));
  718.         }
  719.         
  720.         GetScrollRange(ThisDoc->hDocWnd, SB_VERT, &ScMin, &ScMax);
  721.         // Check to see if text selection needs to scroll down.
  722.         if((Y > (int)ThisDoc->ScYHeight) && 
  723.           ((int)ThisDoc->TopLineOrd < ScMax))
  724.         {               
  725.           ScrollText = TRUE;
  726.               
  727.           do // keep scrolling until the mouse moves.
  728.           { 
  729.             TempY = ArtTopSpace + (ThisDoc->ScYLines-1) * ArtLineHeight;
  730.             if(TempY > (int)(ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * ArtLineHeight))
  731.             {
  732.               TempY = (int)ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * (int)ArtLineHeight;
  733.             }  
  734.             
  735.             if (X < ArtSideSpace)
  736.             {
  737.               TempX = ArtSideSpace;
  738.             }
  739.             else
  740.             {
  741.               TempX = min(X, (int)ThisDoc->ScXWidth);
  742.             }
  743.                           
  744.             Previous.LineNum = ThisDoc->EndSelect.LineNum;
  745.             Previous.CharNum = ThisDoc->EndSelect.CharNum;
  746.             SendMessage(ThisDoc->hDocWnd, WM_VSCROLL, SB_LINEDOWN, 0);
  747.             ThisDoc->EndSelect.LineNum = (TempY - (int)ArtTopSpace) / (int)ArtLineHeight + ThisDoc->TopLineOrd; 
  748.             ThisDoc->EndSelect.CharNum = cursor_to_char_number (TempX,TempY,ThisDoc,&BlockPtr,&LinePtr);
  749.             UpdateHighlightedText(ThisDoc, &Previous);
  750.             SendMessage(ThisDoc->hDocWnd, WM_PAINT, 0, 0); 
  751.             if(PeekMessage(&Message, ThisDoc->hDocWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_NOREMOVE))
  752.               break;
  753.             GetCursorPos(&CursorLocation);
  754.             ScreenToClient(ThisDoc->hDocWnd, &CursorLocation);
  755.           }
  756.           while((X == CursorLocation.x) && (Y == CursorLocation.y)
  757.              && ((int)ThisDoc->TopLineOrd < ScMax));
  758.         }     
  759.         
  760.         if (!ScrollText)
  761.         { 
  762.           if (X < ArtSideSpace)
  763.           {
  764.             TempX = ArtSideSpace;
  765.           }
  766.           else
  767.           {
  768.             TempX = min(X, (int)ThisDoc->ScXWidth);
  769.           }
  770.           if (Y < ArtTopSpace)
  771.           {
  772.             TempY = ArtTopSpace;
  773.           }
  774.           else
  775.           {
  776.             TempY = min(Y, (int)(ArtTopSpace + (ThisDoc->ScYLines-1) * ArtLineHeight));
  777.             if(TempY > (int)(ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * ArtLineHeight))
  778.             {
  779.               TempY = (int)ArtTopSpace + ((int)ThisDoc->TotalLines - (int)ThisDoc->TopLineOrd - 1) * (int)ArtLineHeight;
  780.             }  
  781.           }
  782.           
  783.           Previous.LineNum = ThisDoc->EndSelect.LineNum;
  784.           Previous.CharNum = ThisDoc->EndSelect.CharNum;                           
  785.           ThisDoc->EndSelect.LineNum = (TempY - (int)ArtTopSpace) / (int)ArtLineHeight + ThisDoc->TopLineOrd; 
  786.           ThisDoc->EndSelect.CharNum = cursor_to_char_number (TempX, TempY, ThisDoc, &BlockPtr, &LinePtr);
  787.           UpdateHighlightedText(ThisDoc, &Previous);
  788.  
  789.         }
  790.         
  791.         if((ThisDoc->EndSelect.LineNum > ThisDoc->BeginSelect.LineNum) ||
  792.           ((ThisDoc->EndSelect.LineNum == ThisDoc->BeginSelect.LineNum) &&
  793.            (ThisDoc->EndSelect.CharNum >= ThisDoc->BeginSelect.CharNum)))
  794.         {
  795.           if(((Previous.LineNum < ThisDoc->BeginSelect.LineNum) ||
  796.              ((Previous.LineNum == ThisDoc->BeginSelect.LineNum) &&
  797.               (Previous.CharNum <= ThisDoc->BeginSelect.CharNum))))
  798.           {
  799.             InvalidateRect(hWnd, NULL, FALSE);
  800.           } 
  801.         }
  802.         else
  803.         {
  804.           if(((Previous.LineNum > ThisDoc->BeginSelect.LineNum) ||
  805.              ((Previous.LineNum == ThisDoc->BeginSelect.LineNum) &&
  806.               (Previous.CharNum >= ThisDoc->BeginSelect.CharNum))))
  807.           {
  808.             InvalidateRect(hWnd, NULL, FALSE);
  809.           } 
  810.         }       
  811.       }
  812.     }  
  813.     break;  
  814.                     
  815.     case WM_LBUTTONUP:
  816.     {
  817.       int TempX, TempY;
  818.       
  819.       if(DragMouseAction == DRAG_SELECT)
  820.       { 
  821.         DragMouseAction = DRAG_NONE; 
  822.         if(ThisDoc->TextSelected == TRUE)
  823.         {
  824.           X = LOWORD (lParam);
  825.           Y = HIWORD (lParam); 
  826.         
  827.           if (X < ArtSideSpace)
  828.           {
  829.             TempX = ArtSideSpace;
  830.           }
  831.           else
  832.           {
  833.             TempX = min(X, (int)ThisDoc->ScXWidth);
  834.           }
  835.           if (Y < ArtTopSpace)
  836.           {
  837.             TempY = ArtTopSpace;
  838.           }
  839.           else
  840.           {
  841.             TempY = min(Y, (int)(ArtTopSpace + (ThisDoc->ScYLines-1) * ArtLineHeight));
  842.           }
  843.  
  844.           ThisDoc->EndSelect.LineNum = (TempY - (int)ArtTopSpace) / (int)ArtLineHeight + ThisDoc->TopLineOrd; 
  845.           ThisDoc->EndSelect.CharNum = cursor_to_char_number (TempX, TempY, ThisDoc, &BlockPtr, &LinePtr);
  846.           InvalidateRect(ThisDoc->hDocWnd, NULL, FALSE);
  847.        }
  848.         SetCursor(LoadCursor(NULL, IDC_ARROW)); 
  849.         ReleaseCapture();  
  850.       }
  851.     }     
  852.     break;  
  853.        
  854.     case WM_LBUTTONDBLCLK:
  855.       X = LOWORD (lParam);
  856.       Y = HIWORD (lParam);
  857.  
  858.       charnum = cursor_to_char_number (X,Y,ThisDoc,&BlockPtr,&LinePtr);
  859.  
  860.       if (charnum >= 0) {
  861.     textlen = ((TypText far *) ((char far *) LinePtr +
  862.                 sizeof (TypLine)))->NameLen;
  863.  
  864.     textptr = (char far *) ((char far *) LinePtr +
  865.                   sizeof (TypLine) + sizeof (TypText) );
  866.  
  867.     if (textlen)
  868.     {                                       /* find a message-id */
  869.       char far *start, far *end;
  870.  
  871.       for (start = textptr + charnum; start >= textptr; start--) 
  872.         if (*start == '<') break;
  873.  
  874.       for (end = textptr + charnum; end < (textptr + textlen); end++) 
  875.         if (*end == '>') break;
  876.  
  877.       if ((start >= textptr) && (end < (textptr + textlen))) {
  878.         sprintf (str, "%.*Fs", (int) ((long) end - (long) start + 1), start);
  879.         LockLine (ThisDoc->ParentDoc->hParentBlock,
  880.                ThisDoc->ParentDoc->ParentOffset,
  881.                ThisDoc->ParentDoc->ParentLineID,
  882.                &BlockPtr, &LinePtr);
  883.         GroupDoc = (TypGroup far *) ((char far *) LinePtr + sizeof (TypLine));
  884.             ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID, REUSE, SHOW, str);
  885.       }
  886.     }
  887.       }
  888.  
  889.       break;
  890.  
  891.     case WM_VSCROLL:
  892.       ScrollIt (ThisDoc, wParam, lParam);
  893.       break;
  894.       
  895.     case WM_HSCROLL:
  896.              HScrollIt (ThisDoc, wParam, lParam);
  897.              break;
  898.  
  899.     case WM_PAINT:
  900.       {
  901.     HANDLE hBlock;
  902.     unsigned int Offset, MyLen;
  903.     int VertLines, HorzChars;
  904.     int EndofDoc = FALSE;
  905.     int RangeHigh, CurPos;
  906.     int lineNum ;
  907.     char far *textptr;
  908.     TypBlock far *BlockPtr;
  909.     TypLine far *LinePtr;
  910.     int MyColorMask = 1, PrevColorMask = MyColorMask;
  911.     BOOL ROT13Mode = GetArticleRot13Mode(hWnd) ;
  912.     RECT aRect;
  913.     TextSelect FAR *Start, *End;
  914.     SIZE extent;
  915.     HBRUSH hSolidBrush;
  916.         
  917.     hDC = BeginPaint (hWnd, &ps);
  918.     SetBkColor (hDC, ArticleBackgroundColor);
  919.         SetTextColor (hDC, ArticleTextColor);
  920.  
  921.     GetClientRect (hWnd, &myRect);
  922.     VertLines = ThisDoc->ScYLines;
  923.     HorzChars = ThisDoc->ScXChars;
  924.     
  925.     // Prepare to highlight text if it has been selected
  926.     if(ThisDoc->TextSelected)
  927.     {
  928.       // check to see if selection is in a forward direction 
  929.       // (i.e. top-to-bottom or left-to-right
  930.       if((ThisDoc->EndSelect.LineNum > ThisDoc->BeginSelect.LineNum) ||
  931.         ((ThisDoc->EndSelect.LineNum == ThisDoc->BeginSelect.LineNum) &&
  932.          (ThisDoc->EndSelect.CharNum >= ThisDoc->BeginSelect.CharNum)))
  933.       { 
  934.         Start = &ThisDoc->BeginSelect;                                              
  935.         End = &ThisDoc->EndSelect;                       
  936.       }
  937.       else
  938.       {
  939.          Start = &ThisDoc->EndSelect;
  940.          End = &ThisDoc->BeginSelect;  
  941.       }
  942.     }           
  943.     
  944.     LockLine (ThisDoc->hCurTopScBlock, ThisDoc->TopScOffset, ThisDoc->TopScLineID,
  945.           &BlockPtr, &LinePtr);
  946.  
  947.     /* Update the scroll bar thumb position.                 */
  948.  
  949.     CurPos = lineNum = ThisDoc->TopLineOrd;
  950.     if (CurPos < 0)
  951.       CurPos = 0;
  952.     RangeHigh = ThisDoc->TotalLines - VertLines;
  953.     if (RangeHigh < 0)
  954.       RangeHigh = 0;  
  955.     SetScrollRange (hWnd, SB_VERT, 0, RangeHigh, FALSE);
  956.     SetScrollPos (hWnd, SB_VERT, CurPos, TRUE);
  957.                                                                 
  958.     RangeHigh = ThisDoc->LongestLine - ThisDoc->ScXChars; 
  959.     if (RangeHigh < 0) 
  960.     {
  961.       RangeHigh = 0;
  962.       ThisDoc->ScXOffset = 0;
  963.     }
  964.     SetScrollRange (hWnd, SB_HORZ, 0, RangeHigh, FALSE);
  965.     SetScrollPos (hWnd, SB_HORZ, ThisDoc->ScXOffset, TRUE);     
  966.     
  967.     
  968.     /* Now paint this stuff on the screen for debugging. */
  969.  
  970.     X = ArtSideSpace - ThisDoc->ScXOffset * (ArtCharWidth+1);
  971.     Y = ArtTopSpace;
  972.  
  973.     if (LinePtr->length != END_OF_BLOCK)
  974.       do
  975.         {
  976.     //    MyLen = LinePtr->length - sizeof (TypLine) - sizeof (int) - 1;
  977.           MyLen = ((TypText far *) ((char far *) LinePtr +
  978.                     sizeof (TypLine)))->NameLen;
  979.           textptr = (char far *) LinePtr + sizeof (TypLine) + sizeof (TypText);
  980.  
  981.           if  (ROT13Mode && ((unsigned)lineNum > ThisDoc->HeaderLines))
  982.           {  /*  within body of artcile take copy of string to
  983.              avoid changing original data */
  984.          strcpy (mybuf, textptr);
  985.          textptr = mybuf ;
  986.          strROT13(textptr) ;
  987.           }
  988.  
  989.           if (isLineQuotation(textptr))
  990.           {  /* prepare to print a quotation Line */
  991.          SelectObject (hDC, hFontArtQuote);
  992.           } else
  993.           {  /* prepare to print a normal line */
  994.          SelectObject (hDC, hFontArtNormal);
  995.           }
  996.          
  997.           /* Now write out the line. */ 
  998.           /* Check to see the line is to be highlighted */
  999.           if((ThisDoc->TextSelected) && (lineNum >= Start->LineNum) &&
  1000.              (lineNum <= End->LineNum))  
  1001.           {
  1002.             if(MyLen != 0)
  1003.             { 
  1004.               if(Start->LineNum == End->LineNum)
  1005.               { /* Only one line contains highlighted text */
  1006.                 GetTextExtentPoint(hDC, (LPSTR)textptr, Start->CharNum, &extent);
  1007.                 SetRect(&aRect, X, Y, X + extent.cx, Y+ArtLineHeight);
  1008.                 ExtTextOut (hDC, X, Y, ETO_OPAQUE, &aRect, textptr,
  1009.                             Start->CharNum, (LPINT)NULL);  
  1010.                 SetBkColor(hDC, ArticleTextColor);
  1011.                 SetTextColor(hDC, ArticleBackgroundColor);
  1012.                 aRect.left = aRect.right;
  1013.                 GetTextExtentPoint(hDC, (LPSTR)textptr, End->CharNum+1, &extent);
  1014.                 aRect.right = X + extent.cx;
  1015.                 ExtTextOut (hDC, aRect.left, Y, ETO_OPAQUE, &aRect, 
  1016.                             textptr + Start->CharNum, 
  1017.                             End->CharNum - Start->CharNum + 1, (LPINT)NULL);
  1018.                 aRect.left = aRect.right;
  1019.                 GetTextExtentPoint(hDC, (LPSTR) textptr, MyLen, &extent);
  1020.                 aRect.right = X + extent.cx;
  1021.                 SetBkColor(hDC, ArticleBackgroundColor);
  1022.                 SetTextColor(hDC, ArticleTextColor);
  1023.                 ExtTextOut (hDC, aRect.left, Y, ETO_OPAQUE, &aRect, 
  1024.                             textptr + End->CharNum + 1, MyLen - End->CharNum - 1,
  1025.                             (LPINT)NULL);
  1026.                 Y += ArtLineHeight;
  1027.                 lineNum++;
  1028.               }
  1029.               else
  1030.               {
  1031.                 if(lineNum == Start->LineNum)
  1032.                 { /* First line of more than one line to highlight */
  1033.                   GetTextExtentPoint(hDC, (LPSTR)textptr, Start->CharNum, &extent);
  1034.                   SetRect(&aRect, X, Y, X + extent.cx, Y+ArtLineHeight);
  1035.                   ExtTextOut(hDC, X, Y, ETO_OPAQUE, &aRect, textptr,
  1036.                              Start->CharNum, (LPINT)NULL);  
  1037.                   SetBkColor(hDC, ArticleTextColor);
  1038.                   SetTextColor(hDC, ArticleBackgroundColor);
  1039.                   aRect.left = aRect.right;
  1040.                   GetTextExtentPoint(hDC, (LPSTR)textptr, MyLen, &extent);
  1041.                   aRect.right = X + extent.cx;
  1042.                   ExtTextOut(hDC, aRect.left, Y, ETO_OPAQUE, &aRect,
  1043.                              textptr + Start->CharNum, MyLen - Start->CharNum,
  1044.                              (LPINT)NULL);
  1045.                   SetBkColor(hDC, ArticleBackgroundColor);
  1046.                   SetTextColor(hDC, ArticleTextColor);
  1047.                 }
  1048.                 if((lineNum > Start->LineNum) && (lineNum < End->LineNum))
  1049.                 { /* Whole lines to be highlighted */ 
  1050.                   GetTextExtentPoint(hDC, (LPSTR)textptr, MyLen, &extent);
  1051.                   SetRect(&aRect, X, Y, X + extent.cx, Y+ArtLineHeight);
  1052.                   SetBkColor(hDC, ArticleTextColor);
  1053.                   SetTextColor(hDC, ArticleBackgroundColor);
  1054.                   ExtTextOut (hDC, X, Y, ETO_OPAQUE, &aRect, textptr,
  1055.                               MyLen, (LPINT)NULL);                          
  1056.                   SetBkColor(hDC, ArticleBackgroundColor);
  1057.                   SetTextColor(hDC, ArticleTextColor);
  1058.                 }
  1059.                 if(lineNum == End->LineNum)
  1060.                 { /* Last line to be highlighted */ 
  1061.                   SetBkColor(hDC, ArticleTextColor);
  1062.                   SetTextColor(hDC, ArticleBackgroundColor);
  1063.                   GetTextExtentPoint(hDC, (LPSTR)textptr, End->CharNum + 1, &extent);
  1064.                   SetRect(&aRect, X, Y, X + extent.cx, Y+ArtLineHeight);
  1065.                   ExtTextOut(hDC, X, Y, ETO_OPAQUE, &aRect, textptr,
  1066.                              End->CharNum + 1, (LPINT)NULL);  
  1067.                   aRect.left = aRect.right;
  1068.                   GetTextExtentPoint(hDC, (LPSTR)textptr, MyLen, &extent);
  1069.                   aRect.right = X + extent.cx;
  1070.                   SetBkColor(hDC, ArticleBackgroundColor);
  1071.                   SetTextColor(hDC, ArticleTextColor);
  1072.                   ExtTextOut(hDC, aRect.left, Y, ETO_OPAQUE, &aRect,
  1073.                              textptr + End->CharNum + 1, MyLen - End->CharNum - 1,
  1074.                              (LPINT)NULL);
  1075.                 }
  1076.  
  1077.                 Y += ArtLineHeight;
  1078.                 lineNum++;                    
  1079.               
  1080.               }    
  1081.             }
  1082.             else
  1083.             { /* Blank Line -- Rectangle for CR/LF */
  1084.               SetRect(&aRect, X, Y, X+4, Y+ArtLineHeight);
  1085.               hSolidBrush = CreateSolidBrush(ArticleTextColor);
  1086.               FillRect(hDC, &aRect, hSolidBrush); 
  1087.               DeleteObject((HGDIOBJ)hSolidBrush);
  1088.               Y += ArtLineHeight;
  1089.               lineNum++;
  1090.             }  
  1091.           } 
  1092.           else
  1093.           { /* Line is not highlighted */
  1094.             GetTextExtentPoint(hDC, (LPSTR)textptr, MyLen, &extent);
  1095.             SetRect (&aRect, X, Y, X + extent.cx, Y+ArtLineHeight);
  1096.           
  1097.             ExtTextOut (hDC, X, Y, ETO_OPAQUE, &aRect, textptr,
  1098.                         MyLen, (LPINT)NULL);       
  1099.             aRect.left = aRect.right;
  1100.             Y += ArtLineHeight;
  1101.             lineNum++ ; 
  1102.           }
  1103.                                          
  1104.         /* Fill in the space to the right of the end of the line *
  1105.          * with the article background color                     */                                         
  1106.         aRect.left = aRect.right;
  1107.         aRect.right = ThisDoc->ScXWidth;               
  1108.         hSolidBrush = CreateSolidBrush(ArticleBackgroundColor);
  1109.         FillRect(hDC, &aRect, hSolidBrush);
  1110.         DeleteObject((HGDIOBJ)hSolidBrush); 
  1111.           
  1112.         }
  1113.       while (--VertLines > 0 && NextLine (&BlockPtr, &LinePtr));  
  1114.       
  1115.                                                             
  1116.     /* We've reached the end of the data to be displayed     */
  1117.     /* on this window.  If there's more screen real estate   */
  1118.     /* left, just blank it out and blank top space.          */
  1119.     SelectObject (hDC, hArticleBackgroundBrush);
  1120.     PatBlt (hDC, 0, Y, myRect.right - 1, myRect.bottom - Y, PATCOPY); 
  1121.     PatBlt (hDC, 0, 0, myRect.right - 1, ArtTopSpace, PATCOPY); 
  1122.     if(ThisDoc->ScXOffset == 0)
  1123.     {
  1124.       PatBlt (hDC, 0, 0, ArtSideSpace, ThisDoc->ScYHeight, PATCOPY);
  1125.     }  
  1126.        
  1127.     UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  1128.     EndPaint (hWnd, &ps);
  1129.     break;
  1130.       }
  1131.  
  1132.     case IDM_ARTICLE_RETRIEVE_COMPLETE:
  1133.        SetArticleMenus(hWnd, ENABLE);
  1134.        break;
  1135.  
  1136.     case WM_COMMAND:
  1137.       switch (LOWORD(wParam))
  1138.     {
  1139.     case IDM_EXIT: 
  1140.      ThisDoc->TextSelected = FALSE;
  1141.      CloseArtWnd(hWnd, ThisDoc);
  1142.       break;
  1143.  
  1144.     case IDM_SAVE:
  1145.       if (strcmp (SaveArtFileName, ""))
  1146.         {
  1147.           SaveArtAppend = TRUE;
  1148.           MRRWriteDocument (ActiveArticleDoc, sizeof (TypText), SaveArtFileName, SaveArtAppend);
  1149.           /* Should the 0 be sizeof(TypText) ? */
  1150.           break;
  1151.         }
  1152.       else
  1153.         {
  1154.           goto saveas;
  1155.         }
  1156.  
  1157.     case IDM_SAVEAS:
  1158.     saveas:;
  1159.  
  1160.       if (DialogBox (hInst, "WinVnSaveArt", hWnd, lpfnWinVnSaveArtDlg))
  1161.         {
  1162.           InvalidateRect (hWnd, NULL, TRUE);
  1163.         }
  1164.       break;
  1165.  
  1166.     case IDM_PRINT:
  1167.         PrintArticle(hWnd,ThisDoc);
  1168.  
  1169.       break;
  1170.             
  1171.         case IDM_PRINT_SETUP:
  1172.         PrinterSetup(hWnd,PD_PRINTSETUP);
  1173.  
  1174.       break; 
  1175.       
  1176.     case IDM_DECODE_ARTICLE: 
  1177.       if (TestDecodeBusy(hWnd, "Can't decode this article"))
  1178.          break;
  1179.       if (CommBusy && CommDoc == ThisDoc)
  1180.       {
  1181.          MessageBox (hWnd, "Please wait until article retrieval is complete before decoding", "Please Wait", MB_OK);
  1182.          break;
  1183.       }    
  1184.  
  1185.       if (!DialogBoxParam (hInst, "WinVnDecodeArts", hWnd, lpfnWinVnDecodeArtsDlg, 0))
  1186.          InvalidateRect (hWnd, NULL, TRUE);
  1187.       else
  1188.          DecodeDoc (hWnd, ActiveArticleDoc);
  1189.       break;
  1190.               
  1191.     case IDM_SELECT_ALL:
  1192.       EnableMenuItem(GetMenu(hWnd),IDM_COPY,MF_ENABLED) ;
  1193.       EnableMenuItem(GetMenu(hWnd),IDM_DESELECT_ALL,MF_ENABLED) ;
  1194.       ThisDoc->TextSelected = TRUE;
  1195.       ThisDoc->BeginSelect.LineNum = 0;
  1196.       ThisDoc->BeginSelect.CharNum = 0; 
  1197.       ThisDoc->EndSelect.LineNum = ThisDoc->TotalLines - 1;
  1198.       FindLineOrd(ThisDoc, (unsigned)ThisDoc->EndSelect.LineNum, &BlockPtr, &LinePtr);
  1199.       textlen = ((TypText far *) ((char far *) (LinePtr) +
  1200.                  sizeof (TypLine)))->NameLen;
  1201.       ThisDoc->EndSelect.CharNum = textlen - 1;
  1202.       GetClientRect(hWnd, &myRect);
  1203.       InvalidateRect(hWnd, &myRect, FALSE);         
  1204.       break;                                             
  1205.     
  1206.     case IDM_DESELECT_ALL:
  1207.       EnableMenuItem(GetMenu(hWnd),IDM_COPY,MF_GRAYED) ;
  1208.       EnableMenuItem(GetMenu(hWnd),IDM_DESELECT_ALL,MF_GRAYED) ;
  1209.       ThisDoc->TextSelected = FALSE;
  1210.       GetClientRect(hWnd, &myRect);
  1211.       InvalidateRect(hWnd, &myRect, FALSE);         
  1212.       break;                                             
  1213.     
  1214.     case IDM_COPY:
  1215.       CopyTextToClipBoard(ThisDoc);
  1216.       break;                                             
  1217.     
  1218.     case IDM_FIND_NEXT_SAME:
  1219.     case IDM_NEXT_ARTICLE:
  1220.     case IDM_PREV_ARTICLE:
  1221.          case IDM_FIND_NEXT_UNSEEN:
  1222.          
  1223.       if (ThisDoc->ParentDoc)
  1224.         {
  1225.           LockLine (ThisDoc->ParentDoc->hParentBlock,
  1226.             ThisDoc->ParentDoc->ParentOffset,
  1227.             ThisDoc->ParentDoc->ParentLineID,
  1228.             &BlockPtr, &LinePtr);
  1229.  
  1230.           GroupDoc = (TypGroup far *) ((char far *) LinePtr + sizeof (TypLine));
  1231.               
  1232.               if (GroupDoc)
  1233.                {
  1234.                if (LOWORD(wParam) == IDM_FIND_NEXT_UNSEEN) {
  1235.         header_handle = GroupDoc->header_handle;
  1236.         thread_handle = GroupDoc->thread_handle;
  1237.         headers = lock_headers (header_handle,thread_handle);
  1238.         artindex = ThisDoc->LastSeenLineID;
  1239.           header_num = -1; 
  1240.           
  1241.           while ((++artindex < GroupDoc->total_headers) && header_num < 0)
  1242.             {
  1243.                     header = header_elt (headers,artindex);
  1244.                     if (!header->Seen) header_num = artindex;
  1245.                   } 
  1246.  
  1247.         unlock_headers (header_handle, thread_handle); 
  1248.         if (header_num >= 0)
  1249.         {
  1250.           ViewArticle (ThisDoc->ParentDoc, header_num, REUSE, SHOW, NO_ID);
  1251.           AdjustTopScByDoc (ThisDoc->ParentDoc, (unsigned int)header_num);
  1252.         } else MessageBox (hWnd, "No more Unseen articles in this Group", "That's all!", MB_OK);
  1253.           } 
  1254.           else if (LOWORD(wParam) == IDM_FIND_NEXT_SAME) {
  1255.         header_handle = GroupDoc->header_handle;
  1256.         thread_handle = GroupDoc->thread_handle;
  1257.         headers = lock_headers (header_handle,thread_handle);
  1258.  
  1259.         header_num =
  1260.           find_article_by_subject (headers,
  1261.                        ThisDoc->LastSeenLineID,
  1262.                        GroupDoc->total_headers-1);
  1263.  
  1264.         unlock_headers (header_handle, thread_handle); 
  1265.         if (header_num >= 0) {
  1266.           ViewArticle (ThisDoc->ParentDoc, header_num, REUSE, SHOW, NO_ID);
  1267.           AdjustTopScByDoc (ThisDoc->ParentDoc, (unsigned int)header_num);
  1268.         } else MessageBox (hWnd, "No more articles", "That's all!", MB_OK);
  1269.            }
  1270.  
  1271.           else if ((LOWORD(wParam) == IDM_NEXT_ARTICLE)
  1272.             && (ThisDoc->LastSeenLineID < (GroupDoc->total_headers - 1) )) {
  1273.                ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID + 1, REUSE, SHOW, NO_ID);
  1274.                AdjustTopScByDoc (ThisDoc->ParentDoc, (unsigned int)ThisDoc->LastSeenLineID + 1);
  1275.               } else if ((LOWORD(wParam) == IDM_PREV_ARTICLE)
  1276.                    && (ThisDoc->LastSeenLineID > 0 )) {
  1277.                ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID - 1, REUSE, SHOW, NO_ID);
  1278.                AdjustTopScByDoc (ThisDoc->ParentDoc, (unsigned int)ThisDoc->LastSeenLineID - 1);
  1279.               } else MessageBox (hWnd, "No more articles", "That's all!", MB_OK);
  1280.           }
  1281.  
  1282.            else  MessageBox (hWnd, "Sorry--you must have the group window around\n"
  1283.                          "\for me to be able to find the next article",
  1284.                    "Can't find next article", MB_OK);
  1285.                    
  1286.        UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  1287.        }
  1288.        
  1289.       else
  1290.         MessageBox (hWnd,
  1291.             "That Group's window is gone.  Reopen it.",
  1292.             "Error", MB_OK);
  1293.  
  1294.       break;
  1295.  
  1296.     case IDM_POST:
  1297.       CreatePostingWnd (hWnd, ThisDoc, DOCTYPE_POSTING);
  1298.       break;
  1299.  
  1300.     case IDM_MAIL:
  1301.       (MailCtrl.fnMlWinCreate)(hWnd, ThisDoc, DOCTYPE_MAIL);
  1302.       break;
  1303.  
  1304.     case IDM_FORWARD:
  1305.  
  1306.       (MailCtrl.fnMlForward)(hWnd, ThisDoc);
  1307.       break;
  1308.  
  1309.     case IDM_SEARCH:
  1310.  
  1311.       FindDoc = ThisDoc;                     
  1312.         if (!(FindDoc->SearchStr[0]) && LastArticleTextFind[0]) 
  1313.           strcpy(FindDoc->SearchStr, LastArticleTextFind);
  1314.  
  1315.       if (DialogBox (hInst, "WinVnFind", hWnd, lpfnWinVnFindDlg))
  1316.         {
  1317.           found = DoFind (TRUE);
  1318.           if (!found)
  1319.         {
  1320.           strcpy (mybuf, "\"");
  1321.           strcat (mybuf, FindDoc->SearchStr);
  1322.           strcat (mybuf, "\" not found.");
  1323.           MessageBox (hWnd, mybuf, "Not found", MB_OK);
  1324.         }
  1325.         else
  1326.           strcpy(LastArticleTextFind, FindDoc->SearchStr);
  1327.  
  1328.         }
  1329.  
  1330.       break;
  1331.  
  1332.     case IDM_SEARCH_NEXT:
  1333.  
  1334.       FindDoc = ThisDoc;
  1335.       continueFind = TRUE;
  1336.       if (!FindDoc->SearchStr[0]) {
  1337.          if (!(FindDoc->SearchStr[0]) && LastArticleTextFind[0]) 
  1338.               strcpy(FindDoc->SearchStr, LastArticleTextFind);
  1339.          continueFind = DialogBox (hInst, "WinVnFind", hWnd, lpfnWinVnFindDlg);
  1340.       }
  1341.  
  1342.       if (continueFind && FindDoc->SearchStr[0])
  1343.         {
  1344.           found = DoFind (!FindDoc->hFindBlock && !FindDoc->FindLineID);
  1345.           if (!found)
  1346.         {
  1347.           strcpy (mybuf, "\"");
  1348.           strcat (mybuf, FindDoc->SearchStr);
  1349.           strcat (mybuf, "\" not found.");
  1350.           MessageBox (hWnd, mybuf, "No more occurrences", MB_OK);
  1351.         }
  1352.         }
  1353.       break;
  1354.  
  1355.  
  1356.     case IDM_ROT13:
  1357.        SetArticleRot13Mode(hWnd,GetArticleRot13Mode( hWnd) != TRUE)  ;
  1358.        InvalidateRect (hWnd, NULL, TRUE);
  1359.       break;
  1360.  
  1361.  
  1362.     }
  1363.          
  1364.     break;    
  1365.  
  1366.     default:
  1367.       return (DefWindowProc (hWnd, message, wParam, lParam));
  1368.     }
  1369.   return (0);
  1370. }
  1371.  
  1372. /*------------ CloseArtWnd ------------------------------
  1373.  *
  1374.  *  Make sure this Wnd is not the active Comm window, then destroy it
  1375.  */
  1376. void CloseArtWnd(HWND hWnd, TypDoc *ThisDoc)
  1377. {
  1378.   if (CommBusy && ThisDoc == CommDoc)
  1379.     MessageBox (hWnd,
  1380.         "Please wait until article retrieval is complete",
  1381.         "Cannot close article window", MB_OK|MB_ICONSTOP);
  1382.   else 
  1383.     DestroyWindow (hWnd);
  1384. }
  1385.  
  1386. void 
  1387. SetArticleMailMenu(HWND hWnd)
  1388. {
  1389.     HMENU hMenu, hSubMenu;
  1390.  
  1391.     hMenu = GetMenu (hWnd);
  1392.     hSubMenu = GetSubMenu (hMenu, 4);    // respond menu
  1393.     EnableMenuItem (hSubMenu, IDM_MAIL, MailCtrl.enableMail);
  1394.     EnableMenuItem (hSubMenu, IDM_FORWARD, MailCtrl.enableForward);
  1395. }
  1396.  
  1397. // dis/enable menu items which depend on article being completely retrieved
  1398. void
  1399. SetArticleMenus (HWND hWnd, int enable)
  1400. {
  1401.     HMENU hMenu, hSubMenu;
  1402.     UINT mode;
  1403.     
  1404.     if (enable == ENABLE)    
  1405.         mode = MF_BYCOMMAND|MF_ENABLED;
  1406.     else
  1407.         mode = MF_BYCOMMAND|MF_DISABLED|MF_GRAYED;
  1408.     
  1409.     hMenu = GetMenu (hWnd);
  1410.     hSubMenu = GetSubMenu (hMenu, 0);    // file menu
  1411.     EnableMenuItem (hSubMenu, IDM_SAVE, mode);
  1412.     EnableMenuItem (hSubMenu, IDM_SAVEAS, mode);
  1413.     EnableMenuItem (hSubMenu, IDM_PRINT, mode);
  1414.     EnableMenuItem (hSubMenu, IDM_PRINT_SETUP, mode);
  1415.     EnableMenuItem (hSubMenu, IDM_DECODE_ARTICLE, mode);
  1416.     EnableMenuItem (hSubMenu, IDM_EXIT, mode);
  1417.  
  1418.     hSubMenu = GetSubMenu (hMenu, 1);    // edit menu
  1419.     EnableMenuItem (hSubMenu, IDM_SELECT_ALL, mode);
  1420.  
  1421.     hSubMenu = GetSubMenu (hMenu, 2);    // search menu
  1422.     EnableMenuItem (hSubMenu, IDM_SEARCH, mode);
  1423.     EnableMenuItem (hSubMenu, IDM_SEARCH_NEXT, mode);
  1424.  
  1425.     hSubMenu = GetSubMenu (hMenu, 3);    // view menu
  1426.     EnableMenuItem (hSubMenu, IDM_NEXT_ARTICLE, mode);
  1427.     EnableMenuItem (hSubMenu, IDM_FIND_NEXT_UNSEEN, mode);
  1428.     EnableMenuItem (hSubMenu, IDM_FIND_NEXT_SAME, mode);
  1429.     EnableMenuItem (hSubMenu, IDM_PREV_ARTICLE, mode);
  1430.  
  1431.     hSubMenu = GetSubMenu (hMenu, 4);    // respond menu
  1432.     EnableMenuItem (hSubMenu, IDM_POST, mode);
  1433.     
  1434.     SetArticleMailMenu(hWnd);
  1435. }
  1436.  
  1437. /*------GetArticleRot13Mode-------------------------------
  1438.  *
  1439.  *  Routine to get the this article window Rot mode.
  1440.  *  Note :
  1441.  *     interogation of windows menu state to determine
  1442.  *     ROT13 drawing mode
  1443.  *    
  1444.  *-----------------------------------------------------*/
  1445.        
  1446. BOOL
  1447. GetArticleRot13Mode(HANDLE hWnd)
  1448.  
  1449.  return (GetMenuState(GetMenu(hWnd),IDM_ROT13,NULL) == MF_CHECKED ) ;
  1450. }
  1451.  
  1452. /*------SetArticleRot13Mode-------------------------------
  1453.  *
  1454.  *  Routine to set the this article window into (or out of
  1455.  *  Rot mode).
  1456.  *  Note :
  1457.  *     interogation of windows menu state to determine
  1458.  *     ROT13 drawing mode
  1459.  *     need to invalidate window to force repaint to display
  1460.  *     in new mode
  1461.  *-----------------------------------------------------*/
  1462.        
  1463. void
  1464. SetArticleRot13Mode(HANDLE hWnd,BOOL RotMode)
  1465. {
  1466.   UINT action ;
  1467.  
  1468.   if (RotMode==TRUE) action = MF_CHECKED ;
  1469.   else action = MF_UNCHECKED ;
  1470.  
  1471.   CheckMenuItem( GetMenu(hWnd),IDM_ROT13,action) ;
  1472.  
  1473. }
  1474.  
  1475. /*            strROT13
  1476.  *
  1477.  * change the input string by ROT'ing each character
  1478.  *
  1479.  *
  1480.  */
  1481. void
  1482. strROT13 (char *cstring)
  1483.  
  1484. {
  1485.   char *cptr=cstring ;
  1486.  
  1487.   while (*cptr )
  1488.   {
  1489.       (*cptr++) = chROT13(*cptr);
  1490.  
  1491.   }
  1492. }
  1493.  
  1494. /*            chROT13
  1495.  *
  1496.  * return a new character that is the ROT(ation of) 13 characters
  1497.  * of the input character
  1498.  *
  1499.  *
  1500.  */
  1501. char chROT13(char achar)
  1502. { char newchar ;
  1503.  
  1504.     if (isalpha(achar)) {
  1505.         if ((achar & 31) <= 13) {
  1506.             newchar = achar+13;
  1507.          } else {
  1508.             newchar = achar-13;
  1509.          }
  1510.     } else
  1511.         newchar = achar;
  1512.     
  1513.  return(newchar); 
  1514. }
  1515. /*            strnROT13
  1516.  *
  1517.  * change the input string by ROT'ating each character
  1518.  * for len or end of string (whichever is less)
  1519.  *
  1520.  *
  1521.  */
  1522. void strnROT13(char *cstring, int cstringlen)
  1523. {
  1524.   char *cptr = cstring ;
  1525.   int  clen = cstringlen ;
  1526.  
  1527.   while (*cptr  && clen)
  1528.   {
  1529.       (*cptr) = chROT13(*cptr);
  1530.       cptr++ ;
  1531.       clen-- ;
  1532.   }
  1533.  
  1534.   
  1535.   
  1536.  
  1537.      
  1538. /* UpdateHighlightedText
  1539.  *
  1540.  * This function updates hightlighted text from the previous
  1541.  * position to the current position.
  1542.  *
  1543.  */
  1544.  
  1545. void UpdateHighlightedText(TypDoc far *DocPtr, TextSelect far *PreviousPos)
  1546. {
  1547.    SIZE extent;
  1548.    char far * textptr;
  1549.    int textlen;
  1550.    RECT Rect;
  1551.    int CurrentLineNum;
  1552.    BOOL ChangedSelectionDirection = FALSE;
  1553.    HBRUSH hSolidBrush;
  1554.    HDC hDC;
  1555.    TypBlock far *BlockPtr;
  1556.    TypLine far *LinePtr;
  1557.    TextSelect far *Start, *End, *Temp;
  1558.         
  1559.    hDC = GetDC(DocPtr->hDocWnd);               
  1560.  
  1561.    // check to see if selection is in a forward direction 
  1562.    // (i.e. top-to-bottom or left-to-right
  1563.    if((DocPtr->EndSelect.LineNum > DocPtr->BeginSelect.LineNum) ||
  1564.      ((DocPtr->EndSelect.LineNum == DocPtr->BeginSelect.LineNum) &&
  1565.       (DocPtr->EndSelect.CharNum >= DocPtr->BeginSelect.CharNum)))
  1566.    { 
  1567.      if((PreviousPos->LineNum == -1))
  1568.      {
  1569.        Start = &DocPtr->BeginSelect;                                              
  1570.        if(ChangedSelectionDirection) 
  1571.        {
  1572.          InvalidateRect(DocPtr->hDocWnd, NULL, FALSE);
  1573.        } 
  1574.         
  1575.      }
  1576.      else
  1577.      {  
  1578.        Start = PreviousPos;
  1579.      }  
  1580.      End = &DocPtr->EndSelect;                       
  1581.      
  1582.      // check to see if highlighting or unhighlighting
  1583.      if((End->LineNum > Start->LineNum) ||
  1584.        ((End->LineNum == Start->LineNum) &&
  1585.         (End->CharNum >= Start->CharNum)))
  1586.      {
  1587.        SetBkColor(hDC, ArticleTextColor);
  1588.        SetTextColor(hDC, ArticleBackgroundColor); 
  1589.      }
  1590.      else
  1591.      {
  1592.        SetBkColor(hDC, ArticleBackgroundColor);
  1593.        SetTextColor(hDC, ArticleTextColor); 
  1594.        Temp = Start;
  1595.        Start = End;
  1596.        End = Temp;
  1597.      }       
  1598.    }
  1599.    else
  1600.    {
  1601.  
  1602.      Start = &DocPtr->EndSelect;
  1603.      if((PreviousPos->LineNum == -1))
  1604.      {
  1605.        End = &DocPtr->BeginSelect;                                              
  1606.        if(ChangedSelectionDirection) 
  1607.        {
  1608.          InvalidateRect(DocPtr->hDocWnd, NULL, FALSE); 
  1609.        }  
  1610.      }                                                  
  1611.      else
  1612.      {  
  1613.        End = PreviousPos;  
  1614.      }
  1615.      
  1616.      // check to see if highlighting or unhighlighting
  1617.      if((End->LineNum > Start->LineNum) ||
  1618.        ((End->LineNum == Start->LineNum) &&
  1619.         (End->CharNum >= Start->CharNum)))
  1620.      {
  1621.        SetBkColor(hDC, ArticleTextColor);
  1622.        SetTextColor(hDC, ArticleBackgroundColor);
  1623.      }
  1624.      else       
  1625.      {
  1626.        SetBkColor(hDC, ArticleBackgroundColor);
  1627.        SetTextColor(hDC, ArticleTextColor); 
  1628.        Temp = Start;
  1629.        Start = End;
  1630.        End = Temp;
  1631.      }       
  1632.    }         
  1633.  
  1634.    FindLineOrd(DocPtr, (unsigned)Start->LineNum, &BlockPtr, &LinePtr);
  1635.    textlen = ((TypText far *) ((char far *) (LinePtr) +
  1636.                sizeof (TypLine)))->NameLen; 
  1637.    textptr = (char far *) ((char far *) (LinePtr) + sizeof (TypLine) + sizeof (TypText) );            
  1638.    if (isLineQuotation(textptr))
  1639.    {  /* prepare to print a quotation Line */
  1640.      SelectObject (hDC, hFontArtQuote);
  1641.    }
  1642.    else
  1643.    {  /* prepare to print a normal line */
  1644.      SelectObject (hDC, hFontArtNormal);
  1645.    }
  1646.     
  1647.    GetTextExtentPoint(hDC, (LPSTR)textptr, Start->CharNum, &extent);
  1648.    Rect.top = (int)ArtTopSpace + ((Start->LineNum - (int)DocPtr->TopLineOrd) * (int)ArtLineHeight);
  1649.    Rect.left = extent.cx - ((int)DocPtr->ScXOffset * (ArtCharWidth +1) - ArtSideSpace);
  1650.  
  1651.    if(Start->LineNum == End->LineNum)
  1652.    {
  1653.      GetTextExtentPoint(hDC, (LPSTR)textptr, End->CharNum +1, &extent);
  1654.      Rect.bottom = Rect.top + ArtLineHeight;
  1655.      Rect.right = extent.cx - ((int)DocPtr->ScXOffset * (ArtCharWidth +1) - ArtSideSpace);
  1656.    
  1657.      if(textlen != 0)
  1658.      {
  1659.        ExtTextOut(hDC, Rect.left, Rect.top, ETO_OPAQUE, &Rect, 
  1660.           textptr + Start->CharNum, End->CharNum - Start->CharNum +1, (LPINT)NULL);
  1661.      }
  1662.      else
  1663.      {
  1664.        Rect.right = Rect.left +4;
  1665.        hSolidBrush = CreateSolidBrush(GetBkColor(hDC));
  1666.        FillRect(hDC, &Rect, hSolidBrush);  /* Rectangle used to represent CR/LF */
  1667.        DeleteObject((HGDIOBJ)hSolidBrush);      
  1668.      }     
  1669.     
  1670.      ReleaseDC(DocPtr->hDocWnd, hDC);
  1671.    }
  1672.    else
  1673.    {
  1674.      GetTextExtentPoint(hDC, (LPSTR)textptr, textlen, &extent);
  1675.      Rect.bottom = Rect.top + ArtLineHeight;
  1676.      Rect.right = extent.cx - ((int)DocPtr->ScXOffset * (ArtCharWidth +1) - ArtSideSpace);
  1677.    
  1678.      if(textlen != 0)
  1679.      {
  1680.        ExtTextOut(hDC, Rect.left, Rect.top, ETO_OPAQUE, &Rect, 
  1681.           textptr + Start->CharNum, textlen - Start->CharNum, (LPINT)NULL);
  1682.      }
  1683.      else
  1684.      {
  1685.        Rect.right = Rect.left +4;
  1686.        hSolidBrush = CreateSolidBrush(GetBkColor(hDC));
  1687.        FillRect(hDC, &Rect, hSolidBrush);  /* Rectangle used to represent CR/LF */
  1688.        DeleteObject((HGDIOBJ)hSolidBrush);      
  1689.      }     
  1690.     
  1691.      
  1692.      CurrentLineNum = Start->LineNum + 1;
  1693.      
  1694.      while(CurrentLineNum < End->LineNum) 
  1695.      {             
  1696.        NextLine(&BlockPtr, &LinePtr);
  1697.        textlen = ((TypText far *) ((char far *) (LinePtr) +
  1698.                  sizeof (TypLine)))->NameLen; 
  1699.        textptr = (char far *) ((char far *) (LinePtr) + sizeof (TypLine) + sizeof (TypText) );            
  1700.        if (isLineQuotation(textptr))
  1701.        {  /* prepare to print a quotation Line */
  1702.          SelectObject (hDC, hFontArtQuote);
  1703.        }
  1704.        else
  1705.        {  /* prepare to print a normal line */
  1706.          SelectObject (hDC, hFontArtNormal);
  1707.        } 
  1708.        
  1709.        Rect.top = (int)ArtTopSpace + ((CurrentLineNum - (int)DocPtr->TopLineOrd) * (int)ArtLineHeight);
  1710.        Rect.left = ArtSideSpace - (int)DocPtr->ScXOffset * (ArtCharWidth +1);
  1711.        GetTextExtentPoint(hDC, (LPSTR)textptr, textlen, &extent);
  1712.        Rect.bottom = Rect.top + ArtLineHeight;
  1713.        Rect.right = extent.cx - ((int)DocPtr->ScXOffset * (ArtCharWidth +1) - ArtSideSpace);
  1714.        
  1715.        if(textlen != 0)
  1716.        {
  1717.          ExtTextOut(hDC, Rect.left, Rect.top, ETO_OPAQUE, &Rect, 
  1718.                     textptr, textlen, (LPINT)NULL);
  1719.        }
  1720.        else
  1721.        {
  1722.          Rect.right = Rect.left +4;
  1723.          hSolidBrush = CreateSolidBrush(GetBkColor(hDC));
  1724.          FillRect(hDC, &Rect, hSolidBrush);  /* Rectangle used to represent CR/LF */
  1725.          DeleteObject((HGDIOBJ)hSolidBrush);      
  1726.        }     
  1727.                   
  1728.        CurrentLineNum++;
  1729.        
  1730.      }             
  1731.      
  1732.      NextLine(&BlockPtr, &LinePtr);
  1733.      textlen = ((TypText far *) ((char far *) (LinePtr) +
  1734.                sizeof (TypLine)))->NameLen; 
  1735.      textptr = (char far *) ((char far *) (LinePtr) + sizeof (TypLine) + sizeof (TypText) );            
  1736.      if (isLineQuotation(textptr))
  1737.      {  /* prepare to print a quotation Line */
  1738.        SelectObject (hDC, hFontArtQuote);
  1739.      }
  1740.      else
  1741.      {  /* prepare to print a normal line */
  1742.        SelectObject (hDC, hFontArtNormal);
  1743.      } 
  1744.     
  1745.      Rect.top = (int)ArtTopSpace + ((CurrentLineNum - (int)DocPtr->TopLineOrd) * (int)ArtLineHeight);
  1746.      Rect.left = ArtSideSpace - (int)DocPtr->ScXOffset * (ArtCharWidth +1);
  1747.      GetTextExtentPoint(hDC, (LPSTR)textptr, End->CharNum + 1, &extent);
  1748.      Rect.bottom = Rect.top + ArtLineHeight;
  1749.      Rect.right = extent.cx - ((int)DocPtr->ScXOffset * (ArtCharWidth +1) - ArtSideSpace);
  1750.        
  1751.      if(textlen != 0)
  1752.      {
  1753.        ExtTextOut(hDC, Rect.left, Rect.top, ETO_OPAQUE, &Rect, 
  1754.                   textptr, End->CharNum + 1, (LPINT)NULL);
  1755.      }
  1756.      else
  1757.      {
  1758.        Rect.right = Rect.left +4;
  1759.        hSolidBrush = CreateSolidBrush(GetBkColor(hDC));
  1760.        FillRect(hDC, &Rect, hSolidBrush); /* Rectangle used to represent CR/LF */
  1761.        DeleteObject((HGDIOBJ)hSolidBrush);      
  1762.      }     
  1763.  
  1764.   }  
  1765.                                       
  1766.   ReleaseDC(DocPtr->hDocWnd, hDC);     
  1767.   
  1768. }   
  1769.    
  1770.  
  1771. void CopyTextToClipBoard(TypDoc FAR *DocPtr)   
  1772. {  
  1773.   TextSelect *Start, *End;
  1774.   TypBlock FAR *BlockPtr;
  1775.   TypLine FAR *LinePtr;
  1776.   int CurrentLineNum;
  1777.   int j;
  1778.   int textlen;
  1779.   char FAR *textptr;
  1780.  
  1781.   HGLOBAL hGlobalMemory;
  1782.   char FAR *GlobalMemoryPtr;           
  1783.   DWORD SelectedTextLength = 0;
  1784.       
  1785.   /* Check to see if selection is in a forward direction.           *
  1786.    * Start should always point to first selected position           *
  1787.    * when the document is seen from top-to-bottom and               *
  1788.    * left-to-right.                                                 */
  1789.   if((DocPtr->EndSelect.LineNum > DocPtr->BeginSelect.LineNum) ||
  1790.     ((DocPtr->EndSelect.LineNum == DocPtr->BeginSelect.LineNum) &&
  1791.      (DocPtr->EndSelect.CharNum >= DocPtr->BeginSelect.CharNum)))
  1792.   { 
  1793.     Start = &DocPtr->BeginSelect;                                              
  1794.     End = &DocPtr->EndSelect;                       
  1795.   }
  1796.   else
  1797.   {
  1798.     Start = &DocPtr->EndSelect;
  1799.     End = &DocPtr->BeginSelect;  
  1800.   }         
  1801.  
  1802.   /*Calculate the number of bytes to be moved to the clipboard.     */
  1803.   CurrentLineNum = Start->LineNum;
  1804.   FindLineOrd(DocPtr, (unsigned)CurrentLineNum, &BlockPtr, &LinePtr);
  1805.   textlen = ((TypText far *) ((char far *) (LinePtr) +
  1806.               sizeof (TypLine)))->NameLen;
  1807.       
  1808.   if(Start->LineNum == End->LineNum)                  
  1809.   {
  1810.     /* Text is selected on only one line.                           */
  1811.     SelectedTextLength = End->CharNum - Start->CharNum + 1;
  1812.   }
  1813.   else
  1814.   {
  1815.     /* Length of the first line. The 2 is for CR/LF.                */
  1816.     SelectedTextLength = textlen - Start->CharNum + 2;
  1817.                  
  1818.     NextLine(&BlockPtr, &LinePtr);
  1819.     CurrentLineNum++;
  1820.         
  1821.     /* Add in the lengths of all whole lines selected               */ 
  1822.     while(CurrentLineNum < End->LineNum)
  1823.     {
  1824.        textlen = ((TypText far *) ((char far *) (LinePtr) +
  1825.                   sizeof (TypLine)))->NameLen;
  1826.          
  1827.        SelectedTextLength += textlen + 2;
  1828.        /* The 2 is for CR/LF.                                       */
  1829.          
  1830.        NextLine(&BlockPtr, &LinePtr);
  1831.        CurrentLineNum++;
  1832.     }
  1833.         
  1834.     /* Add in the length of the last line selected.                 */ 
  1835.     textlen = ((TypText far *) ((char far *) (LinePtr) +
  1836.                sizeof (TypLine)))->NameLen;
  1837.     if(textlen != 0)
  1838.     {
  1839.        SelectedTextLength += End->CharNum + 1; 
  1840.     }
  1841.     else
  1842.     {
  1843.        SelectedTextLength += 2;
  1844.        /* The 2 is for CR/LF.                                       */
  1845.     }    
  1846.   }                            
  1847.        
  1848.   /* Allocate memory and move selected text to clipboard.           *
  1849.    * The 1 is for NULL string termination.                          */
  1850.   hGlobalMemory = GlobalAlloc(GHND, SelectedTextLength + 1);
  1851.   if(hGlobalMemory)
  1852.   {
  1853.     GlobalMemoryPtr = GlobalLock(hGlobalMemory);
  1854.     CurrentLineNum = Start->LineNum;
  1855.     FindLineOrd(DocPtr, (unsigned)CurrentLineNum, &BlockPtr, &LinePtr);
  1856.     textlen = ((TypText far *) ((char far *) (LinePtr) +
  1857.                sizeof (TypLine)))->NameLen;
  1858.     textptr = (char far *) ((char far *) (LinePtr) + sizeof (TypLine) + sizeof (TypText) );            
  1859.     /* Move textptr to the first character selected.                 */
  1860.     textptr += Start->CharNum;
  1861.       
  1862.     if(Start->LineNum == End->LineNum)                  
  1863.     { 
  1864.       /* Copy the text from the only line selected.                   */
  1865.       for(j = 0; j < End->CharNum - Start->CharNum + 1; j++)
  1866.       {
  1867.         *GlobalMemoryPtr++ = *textptr++;
  1868.       }  
  1869.     }
  1870.     else
  1871.     {                          
  1872.       /* Copy the first line and add CR/LF at the end of the line.    */  
  1873.       for(j = 0; j < textlen - Start->CharNum; j++)
  1874.       {
  1875.         *GlobalMemoryPtr++ = *textptr++;
  1876.       }  
  1877.       *GlobalMemoryPtr++ = '\r';
  1878.       *GlobalMemoryPtr++ = '\n';
  1879.       NextLine(&BlockPtr, &LinePtr);
  1880.       CurrentLineNum++;
  1881.       /* Copy all whole lines selected add add CR/LF at the end       *
  1882.       * of each line.                                                */
  1883.       while(CurrentLineNum < End->LineNum)
  1884.       {
  1885.          textlen = ((TypText far *) ((char far *) (LinePtr) +
  1886.                     sizeof (TypLine)))->NameLen;
  1887.          textptr = (char far *) ((char far *) (LinePtr) + 
  1888.                     sizeof (TypLine) + sizeof (TypText) );
  1889.          for(j = 0; j < textlen; j++)
  1890.          {
  1891.            *GlobalMemoryPtr++ = *textptr++;
  1892.          }  
  1893.          *GlobalMemoryPtr++ = '\r';
  1894.          *GlobalMemoryPtr++ = '\n';
  1895.         
  1896.          NextLine(&BlockPtr, &LinePtr);
  1897.          CurrentLineNum++;
  1898.       }
  1899.       /* Copy the last line selected                                  */
  1900.       textlen = ((TypText far *) ((char far *) (LinePtr) +
  1901.                  sizeof (TypLine)))->NameLen;
  1902.       textptr = (char far *) ((char far *) (LinePtr) + sizeof (TypLine) + sizeof (TypText) );
  1903.       if(textlen != 0)
  1904.       {
  1905.         for(j = 0; j < End->CharNum + 1; j++)
  1906.         {
  1907.           *GlobalMemoryPtr++ = *textptr++;
  1908.         }  
  1909.       }
  1910.       else
  1911.       {
  1912.         *GlobalMemoryPtr++ = '\r';
  1913.         *GlobalMemoryPtr++ = '\n';
  1914.       }                                 
  1915.     }                                        
  1916.       
  1917.     GlobalUnlock(hGlobalMemory); 
  1918.     OpenClipboard(DocPtr->hDocWnd); 
  1919.     EmptyClipboard();
  1920.       
  1921.     SetClipboardData(CF_TEXT, hGlobalMemory);
  1922.     CloseClipboard();
  1923.   }
  1924.   else
  1925.   {
  1926.     MessageBox(DocPtr->hDocWnd, "Not enough memory to copy selected text.", "Out Of Memory", MB_OK);
  1927.   }
  1928.  
  1929. }     
  1930.    
  1931.                              @
  1932.  
  1933.  
  1934. 1.32
  1935. log
  1936. @support for cascading windows
  1937. @
  1938. text
  1939. @d3 1
  1940. a3 1
  1941.  * $Id: wvart.c 1.31 1994/09/16 00:53:16 jcooper Exp $
  1942. d5 6
  1943. d351 4
  1944. a354 2
  1945.        CopyTextToClipBoard(ThisDoc);
  1946.        SendMessage (hWnd, (UINT) WM_COMMAND, (WPARAM) IDM_DESELECT_ALL, (LPARAM) 0L);  //Un-mark selection
  1947. @
  1948.  
  1949.  
  1950. 1.31
  1951. log
  1952. @massive cleanup for 92.6
  1953. @
  1954. text
  1955. @d3 1
  1956. a3 1
  1957.  * $Id: wvart.c 1.30 1994/08/24 17:59:26 jcooper Exp $
  1958. d5 3
  1959. d225 1
  1960. d252 2
  1961. a253 1
  1962.     case WM_DESTROY:                
  1963. d992 1
  1964. a992 1
  1965.       if (!DialogBox (hInst, "WinVnDecodeArts", hWnd, lpfnWinVnDecodeArtsDlg))
  1966. @
  1967.  
  1968.  
  1969. 1.30
  1970. log
  1971. @misc encoding/decoding changes
  1972. @
  1973. text
  1974. @d3 1
  1975. a3 1
  1976.  * $Id: wvart.c 1.29 1994/08/11 00:18:04 jcooper Exp $
  1977. d5 3
  1978. d110 5
  1979. a115 3
  1980. #include "windows.h"
  1981. #include "WVglob.h"
  1982. #include "WinVn.h"
  1983. d195 1
  1984. a234 5
  1985. /*  case WM_INITMENUPOPUP:        // JSC - now handled in SetArticleMenus 
  1986.       EnableMenuItem(GetMenu(hWnd),IDM_MAIL,MailCtrl.enableMail) ;
  1987.       EnableMenuItem(GetMenu(hWnd),IDM_FORWARD,MailCtrl.enableForward);
  1988.       break;
  1989. */
  1990. d251 2
  1991. d339 6
  1992. d1113 3
  1993. a1115 1
  1994.       FindDoc = ThisDoc;
  1995. d1127 3
  1996. d1137 8
  1997. a1144 1
  1998.       if (strcmp (FindDoc->SearchStr, ""))
  1999. d1146 1
  2000. a1146 1
  2001.           found = DoFind (FALSE);
  2002. d1184 1
  2003. a1184 3
  2004.   else {
  2005.     ThisDoc->LongestLine = 0;
  2006.     ThisDoc->ScXOffset = 0;
  2007. a1185 1
  2008.   }
  2009. d1188 11
  2010. d1235 2
  2011. a1236 2
  2012.     EnableMenuItem (hSubMenu, IDM_MAIL, mode);
  2013.     EnableMenuItem (hSubMenu, IDM_FORWARD, mode);
  2014. @
  2015.  
  2016.  
  2017. 1.29
  2018. log
  2019. @added support for article retreive complete message
  2020. @
  2021. text
  2022. @d3 1
  2023. a3 1
  2024.  * $Id: wvart.c 1.28 1994/08/03 00:54:10 gardnerd Exp $
  2025. d5 3
  2026. d1042 1
  2027. d1044 3
  2028. a1046 3
  2029.         else MessageBox (hWnd, "No more Unseen articles in this Group", "That's all!", MB_OK);
  2030.             } 
  2031.           
  2032. d1058 1
  2033. a1058 1
  2034.         if (header_num >= 0)
  2035. d1060 2
  2036. a1061 1
  2037.         else MessageBox (hWnd, "No more articles", "That's all!", MB_OK);
  2038. d1065 8
  2039. a1072 7
  2040.             && (ThisDoc->LastSeenLineID <
  2041.                 (GroupDoc->total_headers - 1) ))
  2042.               ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID + 1, REUSE, SHOW, NO_ID);
  2043.               else if ((LOWORD(wParam) == IDM_PREV_ARTICLE)
  2044.                    && (ThisDoc->LastSeenLineID > 0 ))
  2045.               ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID - 1, REUSE, SHOW, NO_ID);
  2046.               else MessageBox (hWnd, "No more articles", "That's all!", MB_OK);
  2047. d1074 1
  2048. a1074 1
  2049.           
  2050. @
  2051.  
  2052.  
  2053.  
  2054. 1.28
  2055. log
  2056. @Fixed bug with cut to clipboard at 1st and last line of text
  2057. @
  2058. text
  2059. @d3 1
  2060. a3 1
  2061.  * $Id: wvart.c 1.27 1994/07/27 21:14:38 gardnerd Exp $
  2062. d5 3
  2063. d114 1
  2064. d212 4
  2065. d226 1
  2066. a226 1
  2067.     case WM_INITMENUPOPUP:
  2068. d230 1
  2069. a230 1
  2070.  
  2071. d310 3
  2072. a312 2
  2073.              {
  2074.               SendMessage (hWnd,(UINT) WM_COMMAND, (WPARAM) IDM_FIND_NEXT_UNSEEN, (LPARAM) 0L); 
  2075. d922 4
  2076. a928 1
  2077.  
  2078. d1162 40
  2079. @
  2080.  
  2081.  
  2082.  
  2083. 1.27
  2084. log
  2085. @copy to clipboard
  2086. @
  2087. text
  2088. @d3 1
  2089. a3 1
  2090.  * $Id: wvart.c 1.26 1994/07/12 19:16:13 rushing Exp $
  2091. d5 3
  2092. d324 9
  2093. a332 6
  2094.     case WM_LBUTTONDOWN:            
  2095.       if (CommBusy && CommDoc == ThisDoc)
  2096.       {
  2097.          MessageBox (hWnd, "Please wait until article retrieval is complete before selecting text.", "Please Wait", MB_OK);
  2098.       }
  2099.       else    
  2100. d340 25
  2101. a364 2
  2102.         ThisDoc->BeginSelect.LineNum = (Y - ArtTopSpace) / ArtLineHeight + ThisDoc->TopLineOrd;
  2103.         ThisDoc->BeginSelect.CharNum = cursor_to_char_number (X,Y,ThisDoc,&BlockPtr,&LinePtr);
  2104. d370 3
  2105. a372 2
  2106.       }  
  2107.       break;  
  2108. d407 4
  2109. d445 4
  2110. d511 5
  2111. d558 4
  2112. @
  2113.  
  2114.  
  2115.  
  2116. 1.26
  2117. log
  2118. @missing curlies in CloseArtWnd()
  2119. @
  2120. text
  2121. @d3 1
  2122. a3 1
  2123.  * $Id: wvart.c 1.25 1994/07/01 03:45:53 dumoulin Exp rushing $
  2124. d5 3
  2125. d105 4
  2126. a108 1
  2127.  
  2128. d186 1
  2129. a186 2
  2130.  
  2131.  
  2132. d229 1
  2133. d233 2
  2134. a234 1
  2135.     case WM_DESTROY:
  2136. d319 203
  2137. a521 1
  2138.       break;
  2139. d523 65
  2140. d647 3
  2141. d658 20
  2142. a677 1
  2143.  
  2144. d730 100
  2145. a829 3
  2146.  
  2147.           /* Now write out the line. */
  2148.           SetRect (&aRect, 0, Y, myRect.right, Y+ArtLineHeight);
  2149. d831 14
  2150. a845 5
  2151.           ExtTextOut (hDC, X, Y, ETO_OPAQUE, &aRect, textptr,
  2152.                       MyLen, (LPINT)NULL);
  2153.           
  2154.           Y += ArtLineHeight;
  2155.           lineNum++ ;
  2156. d847 2
  2157. a848 1
  2158.       while (--VertLines > 0 && NextLine (&BlockPtr, &LinePtr));
  2159. d852 1
  2160. a852 1
  2161.     /* left, just blank it out.                              */
  2162. d855 6
  2163. a860 1
  2164.  
  2165. d870 2
  2166. a871 1
  2167.     case IDM_EXIT:
  2168. d921 28
  2169. a948 1
  2170.  
  2171. d1203 399
  2172. a1601 1
  2173. }
  2174. @
  2175.  
  2176.  
  2177.  
  2178. 1.25
  2179. log
  2180. @Added the Find Next Unseen and concept of SPACE as a "power key"
  2181. @
  2182. text
  2183. @d3 1
  2184. a3 1
  2185.  * $Id: wvart.c 1.24 1994/06/30 21:30:22 gardnerd Exp dumoulin $
  2186. d5 3
  2187. d660 7
  2188. a666 6
  2189.       "Please wait until article retrieval is complete",
  2190.       "Cannot close article window", MB_OK|MB_ICONSTOP);
  2191.   else
  2192.      ThisDoc->LongestLine = 0;
  2193.      ThisDoc->ScXOffset = 0;
  2194.      DestroyWindow (hWnd);
  2195. @
  2196.  
  2197.  
  2198.  
  2199. 1.24
  2200. log
  2201. @Allow scrolling by pixels instead of characters
  2202. @
  2203. text
  2204. @d3 1
  2205. a3 1
  2206.  * $Id: wvart.c 1.23 1994/06/23 23:07:13 dumoulin Exp $
  2207. d5 3
  2208. d149 1
  2209. a149 2
  2210. long FAR PASCAL 
  2211. WinVnArtWndProc (hWnd, message, wParam, lParam)
  2212. d171 1
  2213. a171 1
  2214.   TypLineID MyLineID;
  2215. d175 1
  2216. d280 14
  2217. d513 2
  2218. a514 1
  2219.  
  2220. d523 15
  2221. d539 7
  2222. a545 1
  2223.           if (LOWORD(wParam) == IDM_FIND_NEXT_SAME) {
  2224. d559 1
  2225. a559 1
  2226.           }
  2227. d561 1
  2228. a561 3
  2229.           else {
  2230.         if (GroupDoc)
  2231.           { if ((LOWORD(wParam) == IDM_NEXT_ARTICLE)
  2232. a568 6
  2233.             }
  2234.         else MessageBox (hWnd,
  2235.                  "Sorry--you must have the group window around\n"
  2236.                  "\for me to be able to find the next article",
  2237.                  "Can't find next article", MB_OK);
  2238.         UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  2239. d570 8
  2240. a577 1
  2241.         }
  2242. @
  2243.  
  2244.  
  2245.  
  2246. 1.23
  2247. log
  2248. @added menu item for Printer Setup
  2249. @
  2250. text
  2251. @d3 1
  2252. a3 1
  2253.  * $Id: wvart.c 1.22 1994/06/01 19:01:51 gardnerd Exp dumoulin $
  2254. d5 3
  2255. d353 1
  2256. a353 1
  2257.  
  2258. d375 2
  2259. a376 2
  2260.  
  2261.     RangeHigh = ThisDoc->LongestLine - ThisDoc->ScXChars; 
  2262. d383 2
  2263. a384 1
  2264.     SetScrollPos (hWnd, SB_HORZ, ThisDoc->ScXOffset, TRUE); 
  2265. d388 1
  2266. a388 1
  2267.     X = ArtSideSpace;
  2268. d418 3
  2269. a420 11
  2270.           /* Check Horz Scroll to see if a blank line is to be written */
  2271.           if((int)MyLen - (int)ThisDoc->ScXOffset < 0)
  2272.           {
  2273.             ExtTextOut (hDC, X, Y, ETO_OPAQUE, &aRect, " ",
  2274.                         1, (LPINT)NULL);
  2275.           }
  2276.           else
  2277.           {
  2278.             ExtTextOut (hDC, X, Y, ETO_OPAQUE, &aRect, textptr+ThisDoc->ScXOffset,
  2279.                       MyLen-ThisDoc->ScXOffset, (LPINT)NULL);
  2280.           } 
  2281. d422 1
  2282. a422 1
  2283.           Y += ArtLineHeight;
  2284. d426 1
  2285. a426 1
  2286.  
  2287. a429 1
  2288.  
  2289. d431 1
  2290. a431 1
  2291.     PatBlt (hDC, 0, Y, myRect.right - 1, myRect.bottom - Y, PATCOPY);
  2292. @
  2293.  
  2294.  
  2295.  
  2296. 1.22
  2297. log
  2298. @horizontal scrolling support
  2299. @
  2300. text
  2301. @d3 1
  2302. a3 1
  2303.  * $Id: wvart.c 1.21 1994/06/01 18:50:49 rushing Exp $
  2304. d5 3
  2305. d477 3
  2306. d481 2
  2307. @
  2308.  
  2309.  
  2310.  
  2311. 1.21
  2312. log
  2313. @more f3 bugs
  2314. @
  2315. text
  2316. @d3 1
  2317. a3 1
  2318.  * $Id: wvart.c 1.20 1994/05/27 01:29:29 rushing Exp rushing $
  2319. d5 3
  2320. d328 4
  2321. d366 1
  2322. a366 1
  2323.       RangeHigh = 0;
  2324. d370 9
  2325. d410 13
  2326. a422 2
  2327.           ExtTextOut (hDC, X, Y, ETO_OPAQUE, &aRect, textptr, MyLen, (LPINT)NULL);
  2328.  
  2329. d619 2
  2330. @
  2331.  
  2332.  
  2333.  
  2334. 1.20
  2335. log
  2336. @unnecessary winundoc.h
  2337. @
  2338. text
  2339. @d3 1
  2340. a3 1
  2341.  * $Id: wvart.c 1.19 1994/05/23 18:36:00 jcooper Exp rushing $
  2342. d5 3
  2343. d116 1
  2344. @
  2345.  
  2346.  
  2347.  
  2348. 1.19
  2349. log
  2350. @new attach code, session [dis]connect
  2351. @
  2352. text
  2353. @d3 1
  2354. a3 1
  2355.  * $Id: wvart.c 1.18 1994/02/24 21:26:54 jcoop Exp $
  2356. d5 3
  2357. a78 1
  2358. #include "winundoc.h"
  2359. @
  2360.  
  2361.  
  2362.  
  2363. 1.18
  2364. log
  2365. @jcoop changes
  2366. @
  2367. text
  2368. @d3 1
  2369. a3 1
  2370.  * $Id: wvart.c 1.17 1994/01/24 17:41:01 jcoop Exp $
  2371. d5 3
  2372. d81 1
  2373. d203 1
  2374. a203 6
  2375.       if (CommBusy && ThisDoc == CommDoc)
  2376.      MessageBox (hWnd,
  2377.       "Please wait until article retrieval is complete",
  2378.       "Cannot close article window", MB_OK|MB_ICONSTOP);
  2379.       else
  2380.         DestroyWindow (hWnd);
  2381. d412 1
  2382. a412 1
  2383.       DestroyWindow (hWnd);
  2384. d573 14
  2385. @
  2386.  
  2387.  
  2388.  
  2389. 1.17
  2390. log
  2391. @90.2 changes
  2392. @
  2393. text
  2394. @d3 1
  2395. a3 1
  2396.  * $Id: wvart.c 1.16 1994/01/16 12:23:43 jcoop Exp $
  2397. d5 3
  2398. d194 2
  2399. a195 2
  2400.       ThisDoc->ScYLines = (myRect.bottom - myRect.top - TopSpace) / ArtLineHeight;
  2401.       ThisDoc->ScXChars = (myRect.right - myRect.left - SideSpace) / ArtCharWidth;
  2402. d324 1
  2403. a324 2
  2404.     SIZE sz;
  2405.     unsigned int Offset, MyLen, width;
  2406. a327 1
  2407.     int RestX;
  2408. d334 1
  2409. d338 2
  2410. a339 1
  2411.     SelectObject (hDC, hArticleBackgroundBrush);
  2412. d360 2
  2413. a361 2
  2414.     X = SideSpace;
  2415.     Y = StartPen;
  2416. d388 2
  2417. a389 10
  2418.  
  2419.       (GetTextExtentPoint (hDC, textptr, MyLen, &sz));       
  2420.            width = sz.cx;                                     
  2421.           SetTextColor (hDC, ArticleTextColor);
  2422.  
  2423.           TextOut (hDC, X, Y, textptr, MyLen);
  2424.  
  2425.           RestX = X + width;
  2426.           
  2427.           PatBlt (hDC, RestX, Y, myRect.right - RestX, ArtLineHeight, PATCOPY);
  2428. d400 1
  2429. a400 1
  2430.  
  2431. @
  2432.  
  2433.  
  2434.  
  2435. 1.16
  2436. log
  2437. @New font/color painting.  no longer use view_art_by_id
  2438. @
  2439. text
  2440. @d3 1
  2441. a3 1
  2442.  * $Id: wvart.c 1.16 1994/01/16 11:59:44 jcoop Exp $
  2443. d5 3
  2444. d195 9
  2445. a203 1
  2446.  
  2447. @
  2448.  
  2449.  
  2450.  
  2451. 1.15
  2452. log
  2453. @new version box and cr lf consistency
  2454. @
  2455. text
  2456. @a0 1
  2457.  
  2458. d3 1
  2459. a3 1
  2460.  * $Id: wvart.c 1.14 1993/08/25 18:54:36 mbretherton Exp rushing $
  2461. d5 3
  2462. a71 1
  2463. void view_article_by_message_id (TypDoc *Doc, char far *article_request, long artindex);
  2464. d296 1
  2465. a296 1
  2466.         view_article_by_message_id (ThisDoc->ParentDoc, str, ThisDoc->LastSeenLineID);
  2467. d324 2
  2468. a325 1
  2469.  
  2470. d377 1
  2471. d382 1
  2472. d395 1
  2473. a395 1
  2474.     PatBlt (hDC, 0, Y, myRect.right, myRect.bottom - Y, PATCOPY);
  2475. d437 15
  2476. d477 1
  2477. a477 1
  2478.           ViewArticle (ThisDoc->ParentDoc, header_num, REUSE, SHOW);
  2479. d486 1
  2480. a486 1
  2481.               ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID + 1, TRUE, SHOW);
  2482. d489 1
  2483. a489 1
  2484.               ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID - 1, TRUE, SHOW);
  2485. @
  2486.  
  2487.  
  2488.  
  2489. 1.14
  2490. log
  2491. @MRB merge, mail & post logging
  2492. @
  2493. text
  2494. @d1 1
  2495. d4 1
  2496. a4 1
  2497.  * $Id: wvart.c 1.13 1993/08/05 20:06:07 jcoop Exp $
  2498. d6 3
  2499. @
  2500.  
  2501.  
  2502.  
  2503. 1.13
  2504. log
  2505. @save multiple articles changes by jcoop@@oakb2s01.apl.com (John S Cooper)
  2506. @
  2507. text
  2508. @d3 1
  2509. a3 1
  2510.  * $Id: wvart.c 1.12 1993/07/06 21:09:50 cnolan Exp $
  2511. d5 7
  2512. d101 1
  2513. a101 1
  2514.       return (artindex);    /* return the index */
  2515. d104 1
  2516. a104 1
  2517.   return (-1);            /* not found */
  2518. d210 1
  2519. a210 1
  2520.     thread_handle = GroupDoc->thread_handle;    
  2521. d311 1
  2522. a311 1
  2523.         int lineNum ;
  2524. d318 1
  2525. a318 1
  2526.         hDC = BeginPaint (hWnd, &ps);
  2527. d349 1
  2528. a349 1
  2529.               textptr = (char far *) LinePtr + sizeof (TypLine) + sizeof (TypText);
  2530. d354 2
  2531. a355 2
  2532.              strcpy (mybuf, textptr);
  2533.              textptr = mybuf ;
  2534. d365 1
  2535. a365 1
  2536.               }
  2537. d367 1
  2538. a367 1
  2539.               /* Now write out the line. */
  2540. d369 1
  2541. a369 1
  2542.           (GetTextExtentPoint (hDC, textptr, MyLen, &sz));       
  2543. d406 1
  2544. a406 1
  2545.           MRRWriteDocument (ActiveArticleDoc, sizeof (TypText), SaveArtFileName, SaveArtvRef, SaveArtAppend);
  2546. d431 1
  2547. a458 1
  2548.  
  2549. d460 9
  2550. a468 6
  2551.           {
  2552.             if (ThisDoc->LastSeenLineID <
  2553.             (GroupDoc->total_headers - 1) )
  2554.               ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID + 1, REUSE, SHOW);
  2555.             else MessageBox (hWnd, "No more articles", "That's all!", MB_OK);
  2556.           }
  2557. d483 1
  2558. a483 1
  2559.     case IDM_FOLLOWUP:
  2560. d537 2
  2561. a538 2
  2562.       }
  2563.              
  2564. d615 2
  2565. a616 2
  2566.         if (isalpha(achar)) {
  2567.                 if ((achar & 31) <= 13) {
  2568. d620 2
  2569. a621 2
  2570.                  }
  2571.         } else
  2572. d623 1
  2573. a623 1
  2574.         
  2575. @
  2576.  
  2577.  
  2578.  
  2579. 1.12
  2580. log
  2581. @win32 support
  2582. @
  2583. text
  2584. @d3 1
  2585. a3 1
  2586.  * $Id: wvart.c 1.11 1993/06/26 00:53:33 rushing Exp $
  2587. d5 3
  2588. d446 1
  2589. a446 1
  2590.           ViewArticle (ThisDoc->ParentDoc, header_num, TRUE);
  2591. d456 1
  2592. a456 1
  2593.               ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID + 1, TRUE);
  2594. @
  2595.  
  2596.  
  2597.  
  2598. 1.11
  2599. log
  2600. @warnings
  2601. @
  2602. text
  2603. @d3 1
  2604. a3 1
  2605.  * $Id: wvart.c 1.10 1993/06/26 00:18:46 rushing Exp rushing $
  2606. d5 3
  2607. d295 1
  2608. d359 2
  2609. a360 1
  2610.           width = LOWORD (GetTextExtent (hDC, textptr, MyLen));
  2611. d385 1
  2612. a385 1
  2613.       switch (wParam)
  2614. d431 1
  2615. a431 1
  2616.           if (wParam == IDM_FIND_NEXT_SAME) {
  2617. @
  2618.  
  2619.  
  2620.  
  2621. 1.10
  2622. log
  2623. @warnings
  2624. @
  2625. text
  2626. @d3 1
  2627. a3 1
  2628.  * $Id: wvart.c 1.9 1993/06/22 16:45:00 bretherton Exp rushing $
  2629. d5 3
  2630. d337 1
  2631. a337 1
  2632.           if  (ROT13Mode && (lineNum > ThisDoc->HeaderLines))
  2633. @
  2634.  
  2635.  
  2636.  
  2637. 1.9
  2638. log
  2639. @*** empty log message ***
  2640. @
  2641. text
  2642. @d3 1
  2643. a3 1
  2644.  * $Id: wvart.c 1.8 1993/06/11 00:11:26 rushing Exp $
  2645. d5 3
  2646. d555 1
  2647. a555 2
  2648.  
  2649. { HMENU hMenu ;
  2650. @
  2651.  
  2652.  
  2653.  
  2654. 1.8
  2655. log
  2656. @second merge from Matt Bretherton sources
  2657. @
  2658. text
  2659. @d3 1
  2660. a3 1
  2661.  * $Id: wvart.c 1.7 1993/05/29 03:32:30 rushing Exp rushing $
  2662. d5 5
  2663. d157 1
  2664. a157 1
  2665.       EnableMenuItem(GetMenu(hWnd),IDM_FORWARD,MailCtrl.enableMail);
  2666. @
  2667.  
  2668.  
  2669.  
  2670. 1.7
  2671. log
  2672. @threading support
  2673. @
  2674. text
  2675. @d3 1
  2676. a3 1
  2677.  * $Id: wvart.c 1.6 1993/05/28 18:23:40 rushing Exp rushing $
  2678. d5 3
  2679. d150 1
  2680. a150 1
  2681.     case WM_CREATE:
  2682. @
  2683.  
  2684.  
  2685.  
  2686. 1.6
  2687. log
  2688. @fixed far/huge problem in find_art_by_subject
  2689. @
  2690. text
  2691. @d3 1
  2692. a3 1
  2693.  * $Id: wvart.c 1.5 1993/05/24 23:28:24 rushing Exp rushing $
  2694. d5 3
  2695. d59 1
  2696. a59 1
  2697. long find_article_by_subject (TypHeader huge *headers,
  2698. d64 3
  2699. a66 1
  2700.   char far *thissub = headers[artindex++].subject;
  2701. d71 1
  2702. a71 1
  2703.     nextsub = headers[artindex].subject ;
  2704. d114 2
  2705. a115 1
  2706.   TypHeader huge * headers;
  2707. d183 2
  2708. a184 1
  2709.     headers = (TypHeader huge *) (GlobalLock (header_handle) + sizeof(char huge *)) ;
  2710. d186 1
  2711. a186 1
  2712.     headers[ThisDoc->LastSeenLineID].ArtDoc = (TypDoc *) NULL;
  2713. d188 1
  2714. a188 1
  2715.     GlobalUnlock (header_handle);
  2716. d403 45
  2717. a447 34
  2718.         if (ThisDoc->ParentDoc)
  2719.         {
  2720.             LockLine (ThisDoc->ParentDoc->hParentBlock,
  2721.                   ThisDoc->ParentDoc->ParentOffset,
  2722.                   ThisDoc->ParentDoc->ParentLineID,
  2723.                   &BlockPtr, &LinePtr);
  2724.  
  2725.             GroupDoc = (TypGroup far *) ((char far *) LinePtr + sizeof (TypLine));
  2726.  
  2727.             if (wParam == IDM_FIND_NEXT_SAME) {
  2728.                 header_handle = GroupDoc->header_handle;
  2729.                 headers = (TypHeader far *) (GlobalLock (header_handle) + sizeof(char huge *)) ;
  2730.  
  2731.                 header_num = find_article_by_subject (headers,ThisDoc->LastSeenLineID,GroupDoc->total_headers - 1);
  2732.  
  2733.                 GlobalUnlock (header_handle);
  2734.                 if (header_num >= 0)
  2735.                 ViewArticle (ThisDoc->ParentDoc, header_num, TRUE);
  2736.                 else MessageBox (hWnd, "No more articles", "That's all!", MB_OK);
  2737.             }
  2738.  
  2739.             else {
  2740.  
  2741.                 if (GroupDoc)
  2742.                 {
  2743.                   if (ThisDoc->LastSeenLineID < (GroupDoc->total_headers - 1) )
  2744.                     ViewArticle (ThisDoc->ParentDoc, ThisDoc->LastSeenLineID + 1, TRUE);
  2745.                   else MessageBox (hWnd, "No more articles", "That's all!", MB_OK);
  2746.                 }
  2747.                 else MessageBox (hWnd, "Sorry--you must have the group window around\n\for me to be able to find the next article", "Can't find next article", MB_OK);
  2748.             UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  2749.             }
  2750.         }
  2751.         else MessageBox (hWnd, "That Group's window is gone.  Reopen it.", "Error", MB_OK);
  2752. @
  2753.  
  2754.  
  2755.  
  2756. 1.5
  2757. log
  2758. @header formatting (MRB)
  2759. @
  2760. text
  2761. @d3 1
  2762. a3 1
  2763.  * $Id: wvart.c 1.4 1993/05/18 22:11:40 rushing Exp $
  2764. d5 2
  2765. d8 1
  2766. d56 3
  2767. a58 3
  2768. long find_article_by_subject (TypHeader far *headers,
  2769.                 long artindex,
  2770.                 long num_headers)
  2771. d72 1
  2772. a72 1
  2773.   return (-1);                    /* not found */
  2774. @
  2775.  
  2776.  
  2777.  
  2778. 1.4
  2779. log
  2780. @smtp support
  2781. @
  2782. text
  2783. @d3 1
  2784. a3 1
  2785.  * $Id: wvart.c 1.3 1993/05/06 19:43:41 rushing Exp rushing $
  2786. d5 4
  2787. d26 1
  2788. a31 1
  2789. long find_article_by_subject (TypHeader far *headers,long artindex,long num_headers);
  2790. d35 1
  2791. a35 1
  2792. /************** find_article_by_subject *************
  2793. d41 1
  2794. a41 1
  2795.  *  format with wvheadr : GetArticleSubject
  2796. d51 2
  2797. a52 2
  2798. ********************************************************/
  2799.  
  2800. d54 2
  2801. a55 2
  2802.                 long artindex,
  2803.                 long num_headers)
  2804. d60 2
  2805. a61 2
  2806.  
  2807.  
  2808. d68 2
  2809. a69 2
  2810.  
  2811.   return (-1);            /* not found */
  2812. d88 1
  2813. a88 1
  2814.   PAINTSTRUCT ps;        /* paint structure          */
  2815. d90 2
  2816. a91 2
  2817.   HDC hDC;            /* handle to display context */
  2818.   RECT myRect;            /* selection rectangle      */
  2819. d140 1
  2820. d166 4
  2821. a169 4
  2822.            LockLine (ThisDoc->ParentDoc->hParentBlock,
  2823.                      ThisDoc->ParentDoc->ParentOffset,
  2824.                      ThisDoc->ParentDoc->ParentLineID,
  2825.                      &BlockPtr, &LinePtr);
  2826. d231 2
  2827. a232 2
  2828.         textlen = ((TypText far *) ((char far *) LinePtr +
  2829.                                 sizeof (TypLine)))->NameLen;
  2830. d234 2
  2831. a235 2
  2832.         textptr = (char far *) ((char far *) LinePtr +
  2833.                                sizeof (TypLine) + sizeof (TypText) );
  2834. d237 20
  2835. a256 20
  2836.         if (textlen)
  2837.         {                    /* find a message-id */
  2838.           char far *start, far *end;
  2839.  
  2840.           for (start = textptr + charnum; start >= textptr; start--) 
  2841.             if (*start == '<') break;
  2842.  
  2843.           for (end = textptr + charnum; end < (textptr + textlen); end++) 
  2844.             if (*end == '>') break;
  2845.  
  2846.           if ((start >= textptr) && (end < (textptr + textlen))) {
  2847.             sprintf (str, "ARTICLE %.*Fs\r", (int) ((long) end - (long) start + 1), start);
  2848.             LockLine (ThisDoc->ParentDoc->hParentBlock,
  2849.                            ThisDoc->ParentDoc->ParentOffset,
  2850.                    ThisDoc->ParentDoc->ParentLineID,
  2851.                    &BlockPtr, &LinePtr);
  2852.             GroupDoc = (TypGroup far *) ((char far *) LinePtr + sizeof (TypLine));
  2853.             view_article_by_message_id (ThisDoc->ParentDoc, str, ThisDoc->LastSeenLineID);
  2854.           }
  2855.         }
  2856. d273 1
  2857. d278 1
  2858. d280 1
  2859. a280 1
  2860.     hDC = BeginPaint (hWnd, &ps);
  2861. a282 1
  2862.     SelectObject (hDC, hFontArt);
  2863. d291 1
  2864. a291 1
  2865.     CurPos = ThisDoc->TopLineOrd;
  2866. d311 1
  2867. a311 1
  2868.           textptr = (char far *) LinePtr + sizeof (TypLine) + sizeof (TypText);
  2869. d313 15
  2870. a327 1
  2871.           /* Now write out the line.                            */
  2872. d329 2
  2873. d339 1
  2874. d386 1
  2875. a386 1
  2876.             PrintArticle(hWnd,ThisDoc);
  2877. d396 3
  2878. a398 3
  2879.                       ThisDoc->ParentDoc->ParentOffset,
  2880.                       ThisDoc->ParentDoc->ParentLineID,
  2881.                       &BlockPtr, &LinePtr);
  2882. d411 1
  2883. a411 1
  2884.                 else MessageBox (hWnd, "No more articles", "That's all!", MB_OK); 
  2885. d428 1
  2886. a428 1
  2887.           break;
  2888. d440 1
  2889. a440 1
  2890.       (MailCtrl.fnMlForward)(hWnd, ThisDoc, DOCTYPE_MAIL);
  2891. d477 6
  2892. a482 1
  2893.     }
  2894. d484 3
  2895. a486 1
  2896.     break;
  2897. d494 39
  2898. d534 8
  2899. d543 2
  2900. d546 3
  2901. d550 2
  2902. d553 9
  2903. d563 22
  2904. d586 6
  2905. d593 1
  2906. @
  2907.  
  2908.  
  2909.  
  2910. 1.3
  2911. log
  2912. @added Re: fix from MB
  2913. @
  2914. text
  2915. @d3 1
  2916. a3 1
  2917.  * $Id: wvart.c 1.2 1993/03/30 20:08:25 rushing Exp rushing $
  2918. d5 3
  2919. d413 5
  2920. @
  2921.  
  2922.  
  2923.  
  2924. 1.2
  2925. log
  2926. @MAPI
  2927. @
  2928. text
  2929. @d3 5
  2930. a7 2
  2931.  * $Id: wvart.c%v 1.1 1993/02/16 20:53:50 rushing Exp $
  2932.  * $Log: wvart.c%v $
  2933. d28 21
  2934. a48 4
  2935. long
  2936. find_article_by_subject (TypHeader far *headers,
  2937.                 long artindex,
  2938.                 long num_headers)
  2939. d50 13
  2940. a62 8
  2941. char far *subject = headers[artindex++].subject;
  2942.  
  2943.     do {
  2944.         if (lstrcmpi (headers[artindex].subject, subject) == 0)
  2945.         return (artindex);        /* return the index */
  2946.     } while (artindex++ < num_headers);
  2947.  
  2948.     return (-1);            /* not found */
  2949. d64 1
  2950. @
  2951.  
  2952.  
  2953.  
  2954. 1.1
  2955. log
  2956. @Initial revision
  2957. @
  2958. text
  2959. @d3 4
  2960. a6 2
  2961.  * $Id$
  2962.  * $Log$
  2963. d8 1
  2964. d105 4
  2965. d379 1
  2966. a379 1
  2967.       CreatePostingWnd (ThisDoc, DOCTYPE_POSTING);
  2968. d383 1
  2969. a383 1
  2970.       CreatePostingWnd (ThisDoc, DOCTYPE_MAIL);
  2971. @
  2972.  
  2973.